about fopen

i know that this is how to open a file in C
1
2
3
FILE * pfile;
pfile = fopen("C:\\sample.txt", "r");
....


but what if i want to write a file and i dont want it to be written in a disk or folder, but still be able to read it? (only at runtime) ... maybe like in a memory ? i dont know

1
2
3
4
5
6
7
8
char temp[20];
char x[20] = "abcd";
pfile = fopen(temp, "w+");
fputs(x, pfile);

fgets(x, pfile);
fclose(temp);
...

something like that...my point is i dont want it to be written in a disk..only at runtime

if that is possible?

thanks in advance
Last edited on
You want a temporary file.
Topic archived. No new replies allowed.