Prev: Real Mode,16 bit Programming (Intel x86) on Windows XP?
Next: FIXes - correction, FIX one liner
From: Šarūnas Kazlauskas on 18 Nov 2007 17:00 .... or how do you know you've reached the end of txt file?
From: Frank Kotler on 19 Nov 2007 01:59 �aru-nas Kazlauskas wrote: > ... or how do you know you've reached the end of txt file? I've seen 1Ah used. Generally, when you can't read any more, you're at EOF. Your file read will return number of bytes read (in ax for dos - a variable for win32, IIRC). You'll want to watch that value anyway, so you know how many bytes to "process" (whatever you're doing with 'em). When no error is indicated, and you've read zero bytes, you're done. Best, Frank
From: Keith Kanios on 19 Nov 2007 02:07 On Nov 19, 12:59 am, Frank Kotler <fbkot...(a)verizon.net> wrote: > aru-nas Kazlauskas wrote: > > ... or how do you know you've reached the end of txt file? > > I've seen 1Ah used. Generally, when you can't read any more, you're at > EOF. Your file read will return number of bytes read (in ax for dos - a > variable for win32, IIRC). You'll want to watch that value anyway, so > you know how many bytes to "process" (whatever you're doing with 'em). > When no error is indicated, and you've read zero bytes, you're done. > > Best, > Frank Did you mean 0x19?
From: Frank Kotler on 19 Nov 2007 03:13 Keith Kanios wrote: > On Nov 19, 12:59 am, Frank Kotler <fbkot...(a)verizon.net> wrote: >> �aru-nas Kazlauskas wrote: >>> ... or how do you know you've reached the end of txt file? >> I've seen 1Ah used. Generally, when you can't read any more, you're at >> EOF. Your file read will return number of bytes read (in ax for dos - a >> variable for win32, IIRC). You'll want to watch that value anyway, so >> you know how many bytes to "process" (whatever you're doing with 'em). >> When no error is indicated, and you've read zero bytes, you're done. >> >> Best, >> Frank > > Did you mean 0x19? No, 0x1a (aka ctrl-Z). I'm not saying it's "standard"... Best, Frank
From: Rod Pemberton on 19 Nov 2007 04:10 "Sarunas Kazlauskas" <referas(a)gmail.com> wrote in message news:a95a6122-3ebc-42a6-bbdf-0cb7ebfb5fc9(a)l22g2000hsc.googlegroups.com... > what ascii symbol stands for EOF in windows based systems? > ... or how do you know you've reached the end of txt file? > Somewhat vague... What are you trying to do? When are you having the problem? For a function? For a program? Which assembly or Windows functions are a problem? For functions, the function that is reading data will return a special value or flag indicating that the end-of-file has been reached. The file's length information is stored as part of the filesystem. For C based functions, a special value called EOF in stdio.h is returned from functions that read data. IIRC, it can be any integer value that doesn't correspond to a value in the acceptable range of signed or unsigned char, i.e., typically it is a larger integer size say 16 or 32-bit value, but a char is typically smaller, such as 8-bits, and the larger value exceeds 8-bits. Commonly, it is all bits 1 for the default integer size (also known as -1), i.e., 0xFF for 16-bit, 0xFFFF for 32-bits. But, this value isn't stored in the file as ASCII. It's generated by the function when there is no more input from the filesystem. For programs, ctrl-Z will terminate input with some programs. A byte value of zero, 0x00, will sometimes terminate output when binary data is being displayed - depending on the program. Some Windows editors will recognize a byte value of zero as EOF which will terminate reading further data from the file. Unix style programs under Windows programs might recognize ctrl-C, ctrl-D, ctrl-\, ctrl-break, ctrl-M, etc. to terminate input or output. Rod Pemberton
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: Real Mode,16 bit Programming (Intel x86) on Windows XP? Next: FIXes - correction, FIX one liner |