I guess you're unable to understund a bit complex sentences an
paragraphs containing more than one simple sentence.
system(argv[1]); is 100% standard compilant - if the parameter
contains an valid (path)filename.
system("myprog z:\\blah\\blubber-foo.bar.boo"); may not even
impletation compilant as it relays on the filesystem the path points
to.
Maybe you should buy a copy of the standard.
7.20.4.6 The system function
Synopsis
1 #include <stdlib.h>
int system(const char *string);
Description
2 If string is a null pointer, the system function determines whether the host
environment has a command processor. If string is not a null pointer, the system
function passes the string pointed to by string to that command processor to be
executed in a manner which the implementation shall document; this might then
cause the program calling system to behave in a non-conforming manner or to
terminate.
Returns
3 If the argument is a null pointer, the system function returns nonzero only if
a command processor is available. If the argument is not a null pointer, and the
system function does return, it returns an implementation-defined value.
Therefore:-
system("I like cabbage on Fridays");
Seems to me to be perfect ansi C
>
The same is for fopen().
So show me below which bit of the standard says that the first argument to fopen
can contain directories, boxes, houses, or squiggles? If its a valid string
fopen will accept it.
7.19.5.3 The fopen function
Synopsis
1 #include <stdio.h>
FILE *fopen(const char * restrict filename, const char * restrict mode);
Description
2 The fopen function opens the file whose name is the string pointed to by
filename, and associates a stream with it.
3 The argument mode points to a string. If the string is one of the following,
the file is open in the indicated mode. Otherwise, the behavior is undefined.228)
r open text file for reading
w truncate to zero length or create text file for writing
a append; open or create text file for writing at end-of-file
rb open binary file for reading
wb truncate to zero length or create binary file for writing
ab append; open or create binary file for writing at end-of-file
r+ open text file for update (reading and writing)
w+ truncate to zero length or create text file for update
a+ append; open or create text file for update, writing at end-of-file
r+b or rb+ open binary file for update (reading and writing)
w+b or wb+ truncate to zero length or create binary file for update
a+b or ab+ append; open or create binary file for update, writing at end-of-file
228) If the string begins with one of the above sequences, the implementation
might choose to ignore the remaining characters, or it might use them to select
different kinds of a file (some of which might not conform to the properties in
7.19.2).
4 Opening a file with read mode ('r' as the first character in the mode
argument) fails if the file does not exist or cannot be read.
5 Opening a file with append mode ('a' as the first character in the mode
argument) causes all subsequent writes to the file to be forced to the then
current end-of-file, regardless of intervening calls to the fseek function. In
some implementations, opening a binary file with append mode ('b' as the second
or third character in the above list of mode argument values) may initially
position the file position indicator for the stream
beyond the last data written, because of null character padding.
6 When a file is opened with update mode ('+' as the second or third character
in the above list of mode argument values), both input and output may be
performed on the associated stream. However, output shall not be directly
followed by input without an intervening call to the fflush function or to a
file positioning function (fseek, fsetpos, or rewind), and input shall not be
directly followed by output without an intervening call to a file positioning
function, unless the input operation encounters endof-file. Opening (or
creating) a text file with update mode may instead open (or create) a
binary stream in some implementations.
7 When opened, a stream is fully buffered if and only if it can be determined
not to refer to an interactive device. The error and end-of-file indicators for
the stream are cleared.
Returns
8 The fopen function returns a pointer to the object controlling the stream. If
the open operation fails, fopen returns a null pointer.
C itself knows nothing about directories, devises, files. All that is
implementation dependant. So you're outside the topic of this group.
And that has what to do with arguments to a function?
>
Has you ever written a failsave program that handles direcetories
(when supported) and files and had to print to an printer of unknown
type and location but NOT to stdout or stderr who has to run on MVS,
DOS, Windows NT, 2K, XP, Linux, BSD, OS/2 on FAT16, FAT32, NTFS, HPFS,
JFS...? I'm sure the answer is NO.
Have you ever eaten 15 jam donuts in 18 seconds? I'm sure the answer is NO.
Else you would know where the limits of standard C are and how to
handle that propper.
Yes it is possible to write programs who are completely standard
compilant - I've done that often enough to have the same source
running on every C compilant environment. But more often you must use
some implementation specific extensions to get your work done. It is
essential to know the limits of standard C.
--
Adrian