I'd like to handle Unix-style as well as DOS-style line endings on the 
MinGW version of my code. Does anyone have any thoughts on this?

The problem is that I'd prefer to open input files in text mode. When 
your open a NL-only file in text mode, however, fpos/fseek don't work on 
the file. If you get a file position, and then seek to it, you end up 
somewhere else in the file. This works for CR/NL files, of course, but 
not NL-only files.

I've also tried fgetpos/fsetpos, but they have exactly the same problem.

I've also tried _setmode, to set the file mode to binary before the fpos 
and back to text after the fseek. This works for NL-only files, but 
fails for CR/NL files. MSDN also says that you should call _setmode 
before doing any file I/O, so I wouldn't want to do this anyway.

AFAICT, if I want to deal with "text" files that are NL-only, and I want 
to fpos/fseek on those files, then I must open them in binary mode. 
Unfortunately, when I do this, I get other errors in my code, which I 
haven't looked at yet. I guess I may just have to fix these instead.

I suppose one point of view is that you shouldn't open NL-only files in 
"text" mode on Windows, because they're not what Windows considers to be 
"text". Now that I've written it down, I suppose that's the only logical 
answer.

Thoughts?

Thanks -

Paul

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to