Re: Reading Text Files
- From: "JosephKK"<quiettechblue@xxxxxxxxx>
- Date: Sun, 08 Mar 2009 17:43:30 -0700
On Sun, 08 Mar 2009 16:49:23 +0000, Richard Heathfield
<rjh@xxxxxxxxxxxxxxx> wrote:
Keith Thompson said:
<snip>
You asked for cases where the use of '/' will fail. I presented
such
a case. Presenting another case where it doesn't fail doesn't
refute that.
True enough.
The context of the question is Windows, and this really is one of
those questions that has far more to do with Windows than it has
with C, and ought properly to be asked in a group such as
comp.os.ms-windows.programmer.win32. As far as C is concerned, the
first argument to fopen is a string that represents a filename on
the host system. If the string doesn't represent such a filename,
fopen cannot possibly open it, right? So it is the programmer's
responsibility to ensure that the filename is valid. Even if
Windows did support forward slashes as a path separator in all
filename contexts, embedding them in a string literal is a silly
idea if the program is to be portable. Some operating systems don't
even have a concept of "path", at least not in the same sense that
Windows does, or Unix does, or Linux does. There are other ways to
organise files than in an open tree.
Consider, for example, MVS, in which filenames consist of digits,
letters, and dots (and you can't have more than eight non-dot
characters in a row). On many sites, the dots are used as if they
were directory separators, but MVS doesn't enforce this.
Furthermore, MVS allows the creation of Partitioned Data Sets
(PDSs), which consist of multiple members, each of which can be
considered a separate file. Thus, the Partitioned Data Set
FOO.BAR.BAZ might have three members, FOO.BAR.BAZ(QUUX),
FOO.BAR.BAZ(QUUUX) and FOO.BAR.BAZ(QUUUUX). Looked at in this way,
the parentheses can be thought of as (paired) "filename
delimiters", but *only* in the context of a PDS.
A portable C program can easily deal with such a system. I know,
because I've written a great many such programs. The trick is to
avoid hard-coding "magic" filenames.
<snip>
Yep. In the early 1990s i dealt with IBM MVS and had to handle things
called generational data sets, which seem to be a variation of
partitioned data sets, whith the current version and a few to hundreds
of previous generations. I had to get special permission to load
something like 220 MB to 250 MB per week into a 5 generation data set.
A couple years later working with VAX VMS with a similar file naming
system that automatically stored backups.
.
- References:
- Reading Text Files
- From: Mike
- Re: Reading Text Files
- From: Antoninus Twink
- Re: Reading Text Files
- From: JosephKK
- Re: Reading Text Files
- From: Joe Wright
- Re: Reading Text Files
- From: Keith Thompson
- Re: Reading Text Files
- From: Joe Wright
- Re: Reading Text Files
- From: Keith Thompson
- Re: Reading Text Files
- From: Richard Heathfield
- Reading Text Files
- Prev by Date: Re: testing 10
- Next by Date: Re: Newsreaders
- Previous by thread: Re: Reading Text Files
- Next by thread: Re: Reading Text Files
- Index(es):
Relevant Pages
|