Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does \x00 mean in binary file?

Once I asked a guy "what is the difference between ASCII and Binary files?"

And he said "Binary files always have \x00"

I've been searching about this and found What is the meaning of \x00 , \x04 in PHP

so the conclusion is, ASCII files don't have NULL character?

like image 274
Bagong21 Avatar asked May 10 '11 18:05

Bagong21


People also ask

What does \x00 mean?

\x is used to denote an hexadecimal byte. \x00 is thus a byte with all its bits at 0. (As Ryne pointed out, a null character translates to this.) Other examples: \xff is 11111111, \x7f is 01111111, \x80 is 10000000, \x2c is 00101010, etc.

What is \\ x00 -\\ x7F?

US-ASCII is a character set (and an encoding) with some notable features: Values are between 0–127 (x00–x7F) ASCII code-point 32 (decimal) represents a SPACE. ASCII code-point 65 represents the uppercase letter A.

How do I get rid of x00 in Python?

Use the str. replace() method to remove \x00 from a string, e.g. result = my_str. replace('\x00', '') .


1 Answers

An ASCII file might be read or interpreted as having NULL-terminated strings, carriage returns & line-feeds, or other control characters, that are intended to be read and acted on. For example, a text reader might look for a line of text, where a line is "however many characters you see before you get to a linefeed"

A binary file is considered to be just a sequence of bytes - none of them has any special meaning, in the sens that a text-reader would interpret them.

\x00 is an example of a specific byte value (HEX 0), that might be interpreted in a special way by a text reader.

like image 132
jwismar Avatar answered Sep 28 '22 00:09

jwismar