oh yes, and so far the command line I've been using to output the text is basically <filename.c> <filename.txt>. Ideally I am trying to achieve the reverse by typing 3 arguments.
#include <stlib.h>
#include <stio.h>
int main( int argc, char *argv[] )
{
if (argc != 2)
{
printf("%d", argc);
printf("usage: %s text.txt", argv[0]);
}
else
{
FILE *fp = fopen( argv[1], "r" );
if ( file == 0 )
{
printf( "Could not open file\n" );
}
else
{
int x;
while ( ( x = fgetc ( fp ) ) !EOF )
{
printf( "%c", x );
}
fclose(fp);
}
}
}

New Topic/Question
Reply



MultiQuote




|