From: Austin Ziegler Date: 2007-04-16T09:53:56+09:00 Subject: Re: End-of-file character... On 4/15/07, Tim Pease wrote: > On 4/15/07, Sonny Chee wrote: > > Does anyone know of a cross-platform way of generating an 'end-of-file' > > character? Alternatively, does anyone know how to figure out what the > > 'end-of-file' character is for a particular OS? > I had no idea it was platform dependent. I always assumed it was ^D > for all platforms. > > "\004" should be it. This is not correct. There is, in fact, no "end-of-file" character on Unix, and Ctrl-Z (0x26) is the end-of-file character on Windows only when the file is not opened in binary mode. It is conventional for a terminal to accept Ctrl-D (0x04) as an end of file character, but this is convention, not standard. If you want to close a file, just close it. The underlying routines will do the appropriate work necessary. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca