where can i find....

im looking for a example how to copy sdtout to txt,can annyone help me
by showing a example...thanks...

did you write some code to try?
solved.
Last edited on

do you mean whatever is printed, you want that to be inside a variable?

if that is correct, you can use
sprintf
like this.

1
2
char arr[64];
sprintf(arr, "%s", Mem);              //everything in the memory will come in arr array 


check for overflow of the variable.
im verry sorry im not good in c++
what i want to do is whatever its showing in dos screen i want to have it copyed
into a txt file....
solved.
Last edited on

to write to a file, you need to open a file with fopen, write to the file using fwrite and than close the file using fclose. i give you an example. this will write whatever is in the "Mem" to a file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//open the file
FILE *filePtr = fopen("Path_Of_File", "w"); //w tells you want to write to the file.
if(filePtr == NULL)                                        //if somehow file fails to open return
{
    return error;
}

char arr[64];
sprintf(arr, "%s", Mem); 

//write to the file
fwrite(arr, sizeof(char), strlen(arr), filePtr); //you can check, if the write is successful

//close the file
fclose(filePtr);

Topic archived. No new replies allowed.