Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C PR0gramming..

Name: Anonymous 2012-05-26 3:39

Neeeed 'C' Help.

I need to read in input from the command line argument and open the text file ( 2nd arguement; nums1.txt in this case)
ie:  ./shitprogram nums1.txt

and so what would i be inputting here:
fopen("????","r");

I know that argv[1] = "nums1.txt" but how would i use this as a variable in fopen() ?

Name: Anonymous 2012-05-27 15:26

>>16
>finp
Abbreviations are not universally intuitive. I'm sure most people know what an ID is but "finp" is undescriptive. "stream" is still better. If you ever need to have an input and output stream (say you're writing a function that reads from one stream and writes to another), you can just call them "istream" and "ostream". Anyone reading the code immediately knows that both of them are streams, and can hence deduce that one is an input stream and the other an output stream.

>>13
That makes sense, so long as you name them intuitively.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List