File streams are always acceded through pointers and they are always pre-created. But is it possible to create a file stream inside the program as an object that holds space in memory without using an external file?
My first thought was to declare a FILE *
pointer then allocate memory for a FILE
object using malloc()
:
FILE *fileStream = malloc(sizeof(FILE));
but I guess this is not right.
How can I do it the right way so I can work with fileStream
using the I/O functions like fprintf()
and fscanf()
...