Mail Archives: djgpp/1997/09/18/08:00:28
David Lenk <lenkd AT pltpub DOT com> wrote:
> This is the of code from a program that I have been trying to write. I
> need a way of makeing a filename and storing it in a variable so that it
> can be used in a fprintf or fwrite command. I ask if you could please
> anotate the source if you decide to post any.
> #include <stdio.h>
> #include <conio.h>
> void main()
^^^^
main() *must* be declared as returning int.
> {
> int nRanda, table,A, B;
> for (table = 1; table <9; table++)
> {
> nRanda = (rand() % 99999999);
> {
> char A[] = "this will be in the file.";
> char B = nRanda; // B should hold the file name
Okay, let me see if I understand. You got a random number from rand() and
want to create a string from it? The guy you're looking for is gcvt().
> FILE*fp;
> fp = fopen(B, "w");
> fwrite(A, sizeof A, 1, fp);
> fclose(fp);
> }
> }
> }
Your brace style could use a lot of work as well; many find such a "flat"
style exceedingly hard to read and keep track of.
--
[- firewind -]
[- email: firewind AT metroid DOT dyn DOT ml DOT org (home), firewind AT aurdev DOT com (work) -]
[- "You're just jealous because the voices talk to -me-." -]
- Raw text -