txt file
-
How to write the output array to a text file?
-
How to write the output array to a text file?
chaitanya22 wrote:
How to write the output array...
What output array?
chaitanya22 wrote:
How to write...to a text file?
What text file?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
How to write the output array to a text file?
for write to file you can use CArchive But please refer to Reply David Crow
-
How to write the output array to a text file?
if you meant the values of and array in a txt file you can use the binary files to write the whole array in it but binary mode. f=fopen(fname,"bw"); fwrite(array,1,sizeof(int)*nr_of_items,f); fclose(f); but if you want the values to be readable you must convert them first to chars and then write them. char nr[10]; /*if array declared like this int array[100] or int *array*/ f=fopen(fname,"w+"); for (int i=0;i nr_of_items line the entries or something like this. have fun gabby
-
How to write the output array to a text file?
-
chaitanya22 wrote:
How to write the output array...
What output array?
chaitanya22 wrote:
How to write...to a text file?
What text file?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
its an int array[].
-
its an int array[].
Here's one way:
FILE *pFile = fopen("file.txt", "w");
for (int x = 0; x < sizeof(array) / sizeof(array[0]); x++)
fprintf("%d\n", array[x]);
fclose(pFile);Others exist, too.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb