www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/16/23:00:25

From: "David Lenk" <lenkd AT pltpub DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: please I need help on this!
Date: 17 Sep 1997 01:18:38 GMT
Organization: PLT Publishing
Lines: 34
Message-ID: <5vnb5e$qt7@bgtnsc03.worldnet.att.net>
NNTP-Posting-Host: 207.147.130.4
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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()
{
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
FILE*fp;
fp = fopen(B, "w");
fwrite(A, sizeof A, 1, fp);
fclose(fp);
}
}
}

PS I write for DOS.
-- 
Thanks in advance for all your help!

David Lenk,  ~SamWise~
lenkd AT pltpub DOT com
www.pltpub.com/lenkd

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019