eof(fp) doesn't work with DJGPP and text files

General FreeBASIC programming questions.
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

eof(fp) doesn't work with DJGPP and text files

Postby mjs » Jun 20, 2005 3:11

Hi,

when you use the FBC (for DOS) and try to load a text file in the following way:

Code: Select all

defint a-z

dim i as integer
dim l as string

print "Start"

open "test11.txt" for input as #1
while not eof(1)
   line input #1, l
    print "X",l
    i+=1
    if i>10 then print "Aborted": exit while
wend
close #1

print "End"


And the text file (text11.txt) contains of just a single EOF character (ASCII 26 / &H1A) then this program will print 10 lines instead of zero (or one). Please remember that this kind of files were very common in DOS enviroments.

The problem is in fb_FileEof when you check for the file pointer instead of feof() for an INPUT mode file.

Regards,
Mark
v1ctor
Site Admin
Posts: 3801
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Jun 20, 2005 3:39

You've an email, welcome to the team ;).
mjs
Site Admin
Posts: 842
Joined: Jun 16, 2005 19:50
Location: Germany

Postby mjs » Jun 20, 2005 5:00

v1ctor wrote:You've an email, welcome to the team ;).


Wow, thank you ... that's surprising me ...

Regards,
Mark
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Postby DrV » Jun 20, 2005 13:19

Heh, welcome. The more, the merrier. :) (We need all the help we can get..)
MystikShadows
Posts: 612
Joined: Jun 15, 2005 13:22
Location: Upstate NY
Contact:

Postby MystikShadows » Jun 20, 2005 13:54

Where's my email? LOL..
Antoni
Posts: 1393
Joined: May 27, 2005 15:40
Location: Barcelona, Spain

Postby Antoni » Jun 20, 2005 16:19

mjs: Congatulations, new blood in the team is always welcome!

v1ctor: Tie short that guy or you will end with FB compatible with #%$@ syntax :D

Mystik: We have all been accepted as nitpickers and curmudgeons months ago...

Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests