| |||
| Home > ARM Compiler Reference > Standard C implementation definition > Environment | |||
The mapping of a command line from the ARM-based environment
into arguments to main() is implementation-specific.
The generic ARM C library supports the following:
main
interactive device
standard input, output, and error streams.
The arguments given to main() are the
words of the command line (not including I/O redirections), delimited
by white space, except where the white space is contained in double
quotes.
Note that:
a
whitespace character is any character of which isspace() is
true
a double quote or backslash character (\) inside double quotes must be preceded by a backslash character
an I/O redirection will not be recognized inside double quotes.
In an unhosted implementation of the ARM C library, the term interactive
device may be meaningless. The generic ARM C library
supports a pair of devices, both called :tt, intended
to handle a keyboard and a VDU screen. In the generic implementation:
no buffering is done on any
stream connected to :tt unless I/O redirection
has taken place
if I/O redirection other than to :tt has
taken place, full file buffering is used (except where both stdout and stderr have
been redirected to the same file, where line buffering is used).
Using the generic ARM C library, the standard input, output
and error streams stdin, stdout,
and stderr can be redirected at runtime. For
example, if mycopy is a program which simply
copies the standard input to the standard output, the following
line runs the program:
mycopy < infile > outfile 2> errfile
and redirects the files as follows:
stdinis redirected
to infile
stdoutis
redirected to outfile
stderris
redirected to errfile
The following shows the permitted redirections:
0< filenamereads stdin from filename
< filenamereads stdin from filename
1> filenamewrites stdout to filename
> filenamewrites stdout to filename
2> filenamewrites stderr to filename
2>&1writes stderr to
the same place as stdout
>& filenamewrites both stdout and stderr to filename
>> filenameappends stdout to filename
>>& filenameappends both stdout and stderr to filename