What to do next – Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual
Page 60

Chapter 4
Using the Programming Environment
4-8
/*
* Now, as long as we have files on the command line to process,
* open them, read them, and output them to standard output.
*/
for ( i = 1; i < argc; i++ )
{
/*
* Remember, fopen() returns a file pointer. If the file
* pointer returned points to NULL, the file couldn’t be
* opened. Exit and tell the user why.
*/
infil = fopen ( argv[i], “r” );
if ( infil == NULL )
{
fprintf ( stderr,
“*** cat: unable to open %s. Aborting\n”,
argv[i] );
exit ( errno );
}
/*
* Now loop to get all the characters in the input file and
* put them on the output file [“stdout” for “putchar()”].
*/
while ( ( c = getc ( infil ) ) != EOF )
putchar ( c );
/*
* Done with this file. Close it and get the next one...
*/
fclose ( infil );
}
/*
* Done with all the command line arguments, so done with this
* program!
*/
exit ( 0 );
}
When you are familiar with the programming environment, proceed to any
of the chapters listed below.
If you want to:
Go to:
Learn to use the Application Program Interface (API) library of routines;
you can link these routines to your C and BASIC programs for
communication with a programmable controller
Chapter5
Establish Ethernet communication; see examples of using the Internet
Socket Library in C programs
Chapter6
Establish serial port communication
Chapter7
What to Do Next