Re: Pop's Device, was Re: Some Newb Problem with "int", please help.
From: Alex Monjushko (monjushko_at_hotmail.com)
Date: 09/23/04
- Next message: Joona I Palaste: "Re: Pointer question [ Newbie ]"
- Previous message: sieg1974: "Pointer question [ Newbie ]"
- In reply to: Arthur J. O'Dwyer: "Re: Pop's Device, was Re: Some Newb Problem with "int", please help."
- Next in thread: Chris Torek: "Re: Pop's Device, was Re: Some Newb Problem with "int", please help."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Sep 2004 17:59:08 GMT
Arthur J. O'Dwyer <ajo@nospam.andrew.cmu.edu> wrote:
> On Wed, 22 Sep 2004, Dan Pop wrote:
>>
>> "Arthur J. O'Dwyer" <ajo@nospam.andrew.cmu.edu> writes:
>>> There may be problems (and usually are, IME), however, when you
>>> compile pete's code on a Unix or Linux implementation and then try to
>>> feed it a text file generated on a DOS or Windows system.
>>
>> You're invoking undefined behaviour in this case: you're opening in text
>> mode a file which is not a text file (on the platform opening it).
> True. That doesn't mean we should never try to do something reasonable
> with it, though. (I'm not saying one should /always/ catch weird
> newlines, but for programs that need maximum robustness and
> user-friendliness I do think it's one of the first things to do.)
How can you do something reasonable after invoking undefined behavior?
If your file is not formatted to be a text file on the system you are on
then, by definition, it is not a text file and you should not be treating
it as such. On the other hand, if you are absolutely certain of the exact
format variations of the files that you are going to be working with, then
you can attempt to detect and correctly handle these formats in binary mode.
-- Alex Monjushko (monjushko@hotmail.com)
- Next message: Joona I Palaste: "Re: Pointer question [ Newbie ]"
- Previous message: sieg1974: "Pointer question [ Newbie ]"
- In reply to: Arthur J. O'Dwyer: "Re: Pop's Device, was Re: Some Newb Problem with "int", please help."
- Next in thread: Chris Torek: "Re: Pop's Device, was Re: Some Newb Problem with "int", please help."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|