Follow us on Twitter!
The measure of a mans life is not how well he dies, but how well he lives.
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 20
Guests Online: 19
Members Online: 1

Registered Members: 82889
Newest Member: Geriztul
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Php get a certain number of bytes

ranma
Member



Posts: 273
Location: Behind a sphere
Joined: 27.08.05
Rank:
Active User
Posted on 22-05-06 00:30
I want to make a program that will take a certain number of bytes from a file. I have a few questions.
1:
How many bytes is a letter?
2:
Are all characters (a,b,"space", $,7, &, etc...) the same amount of bytes?
3:
How can I make a web page get a certain number of bytes from a file?
4:
How can I make sure I don't cut off a word or something?


BTW how do you filter characters like ' " or &?

Thakns in advance!Wink

Sorry for triple post!

Edited by ranma on 22-05-06 00:33
Author

RE: Php get a certain number of bytes

Mr_Cheese




Posts: 2468
Location: Brighton, UK
Joined: 30.11.04
Rank:
Uber Elite
Posted on 22-05-06 00:37
every charachter is 1 byte.

also in php you can open the file and then you can specify how many bytes of teh file you wish to extract, so you can easily do that.

and there woudlnt be a easy way of making it not cut off a word, because it will read the file based on bytes instead of words. so to make it not cut off 1/2 a word etc you'll have to add a new function that checks the last byte equals a space (the if not add one byte etc), then yuo can be sure it wont cut off a word. ofcourse this will only work on text based files and wont work with exe's / jpgs etc.


http://www.hellboundhackers.org/
Author

RE: Php get a certain number of bytes


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 22-05-06 02:13
usually 1 character = 1 byte

but in the case of unicode

1 unicode character = 2 bytes


Author

RE: Php get a certain number of bytes


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 22-05-06 02:24
The PHP function filesize() will return the number of bytes in the file you provide. So if you're going to read from a file and don't want t count how many bytes are in it, you can do it like this fread($fp, filesize($file));. That way you're pulling out the exact amount of bytes, no need for guess work.



http://php.net/fi. . .