end of file in the middle of a text file [message #91309] |
Mon, 29 June 2015 08:07  |
simmsl
Messages: 1 Registered: June 2015
|
Junior Member |
|
|
I've got an IDL program that seems perfectly capable of reading a number of different text files, but there is one file where it encounters an EOF in the middle of the file.
It reads right up to the middle of the file. I know where it's reading to because I printed out each line it read in. I know it's in the middle of the text file because I can open the text in notepad and see that there's more file left.
So as far as I can tell, it's nowhere near the end of the file. Is there anything that might be embedded in the text file that's causing this to happen? If there was, would there be a way to tell the IDL program to skip over that?
I cleared a bunch of room of my hard drive as well, in hopes that it was just an issue of space. That didn't fix anything. Doesn't matter where in the line up I run this particular text file, the program still has problems with it when the others don't.
Thanks
|
|
|
Re: end of file in the middle of a text file [message #91330 is a reply to message #91309] |
Mon, 29 June 2015 13:58  |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Hello,
On 06/29/15 11:07, simmsl@augsburg.edu wrote:
> I've got an IDL program that seems perfectly capable of reading a
> number of different text files, but there is one file where it
> encounters an EOF in the middle of the file.
>
> It reads right up to the middle of the file. I know where it's
> reading to because I printed out each line it read in. I know it's
> in the middle of the text file because I can open the text in notepad
> and see that there's more file left.
>
> So as far as I can tell, it's nowhere near the end of the file. Is
> there anything that might be embedded in the text file that's causing
> this to happen? If there was, would there be a way to tell the IDL
> program to skip over that?
>
> I cleared a bunch of room of my hard drive as well, in hopes that it
> was just an issue of space. That didn't fix anything. Doesn't
> matter where in the line up I run this particular text file, the
> program still has problems with it when the others don't.
Is your code issuing an error? Or just stopping, but with partial data?
If the former, post the error.
If the latter, you should inspect the offending file to ensure the
end-of-record/line markers are consistent throughout. By that I mean, on
some computers/OSes a carriage return (CR) only is used to signify the
end of a record, on others a CR and then line feed (LF). One is DOS, the
other *nix (I can't recall which is which).
So, if it is a CR/LF issue, it could be that all the lines following the
last successfully read one have the "wrong" end-of line marker so IDL is
simply treating the rest of the file as a single line and, thus, it's
only reading the first bit.
If that sounds like a long shot solution, it is. But, stranger things
have happened.
cheers,
paulv
|
|
|