PDA

View Full Version : Detecting EOF



Nicmus
- 27th January 2008, 01:30
Hello PIC users friends,

I have an application which reads a .txt file from a USB storage device.
With Darrel’s help I solved all my problems on dealing with “Big Numbers” (I promisse Darrel this is the last time you will see the label “big_number” or anything similar to it) to extend the “reach” of an old device to higher number of records (I don’t know how to post a link, but look under “Code examples”/ "Retiving 32bit Multiply Result").

I’m slowly stepping into this magic world of PicBasicPro, my background is not in programming and simple things for the experienced programmer are new to me.
I did few searches but came empty.
I am willing to do the work it takes but I’m a little lost when I’m faced with unfamiliar territory. This is one of them.

I’m planning on working on replacing this “temporary patch” with a newer version and for this I need a way to detect the EOF of a .txt file.
The questions are:

1- If I read the .txt data file, with a PIC, byte by byte and look at each byte, when can I say I reached the EOF?
2- What is the EOF, a special character or a series of characters?
3- Does anyone know of a way to do it or point me to a place which addresses this problem?

Regards,

Nick

Jerson
- 27th January 2008, 05:33
The EOF character in TXT files used to be CTRL-Z or 1A(Hex) since the days of CP/M DOS. Nowadays, I don't think this is true. However, you could check for the $1a character in PBP if it is there.

JF

Nicmus
- 27th January 2008, 13:26
Thank you Jerson.
I will try it and get back with the results.

Regards,

Nick