View Single Post
Old 08-04-2006, 02:14 PM   #3 (permalink)
cn880
Registered User
 
Join Date: Aug 2006
Posts: 5
cn880 is on a distinguished road
Thank you for all your hard work.

Your post helped me get rid of the design problems, but I still need assistance with actually writing the file. I understand the `sprintf' function can be used to save a string to a buffer. In that case, I would use

Code:
sprinf (outfile, "%s-%d", argv[i], j);
correct?

The problem is that I'm still having trouble grasping the concept of strings (which are actually char arrays, I believe?) in C.

I have the algorithm figured out for the most part:

Code:
<string_type> outfile;

sprintf (outfile, "%s-%d", argv[i], j);

fopen (outfile, "w");
But the problem is I don't quite know how to initialize a string. char[999] might work, but I don't want the array to be a fixed size. I tried char** (an array pointer, I believe) but that also caused problems.
cn880 is offline   Reply With Quote