If you are interested in making a text file then
fprintf and fscanf are the functions which you should
be using. Also, if it is really a binary file that you
are interested in creating, then use "wb" instead of
just "w".
For example, this is what you might want to do:
FILE *pFile;
char buffer[] = "???";
MonName = "RockSteady.txt"; // Lets say!!
pFile = fopen(MonName, "w");
fprintf(pFile, "%s", buffer);
fclose(pFile);
Hope this helps,
Siva Chandra.
--- Bah...@ao... wrote:
> all i need to do is write a few variables (int's)
> to a text file. the
> segment of data that makes the file looks like this
> :
>
> FILE * pFile;
> char buffer[] = "???";
> pFile = fopen (MonName, "w");
> fwrite (buffer , 1 , 100 , pFile);
> fclose (pFile);
>
> MonName is the file's name. it turns out to be
> whatever the contents of
> MonName are
>
> ??? is what i need to change
>
> how would i make buffer[] represent :
>
> cout << "The level is " << level << ", and the name
> is " MonName;
> The level is 1 and the monster name is Red Dragon
>
> also, not as important, but how would i have .txt be
> placed at the end of the
> file???
>
__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com
|