help needed to download ascii null from unix

Guy Harris guy at rlgvax.UUCP
Thu Feb 2 13:18:47 AEST 1984


> Uh, write(2,"",1) writes the first byte of your address space, which may
> be zero if you are lucky.  I remember a long discussion a while ago on
> the subject of *0 and what is found there.  I don't remember the outcome
> or positions, but I don't think it is a particularly swift idea in general.

False.  You are probably confusing a null string in C, which is allocated
(like all strings) in a program's data space, with the null string that
lives, purely by coincidence, at location 0 in some systems' address spaces.
Several programs - a lot of them from Berkeley - *depend* on location 0
being a null string; a lot of those programs have been fixed in 4.2 because
on the Sun a large and nasty bear trap lives at location 0 and programs which
try to dereference null pointers get properly punished.

	write(2, "", 1);

writes one byte from wherever the compiler and linker happened to put the
"" mentioned in the call to "write"; that byte would be the first byte of
"" which is a zero byte.  Why would write(2, "", 1) be any different from
write(2, "False statement!\n", 17)?

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.unix mailing list