Hi all, first post here so be nice ;)
Is it possible to store a FILE * in a struct, i see no reason why not but the following code wont compile, i can't seem to store a reference to file pointer either.
typedef struct fileType
{
FILE * file;
char fileName[MAX_FILENAME_LEN];
unsigned linesRead;
unsigned nextBufLine; /* next line to be inserted/removed in the buffer */
pthread_mutex_t * mtxFile; /* mutex controlling access to this file */
}FileType;
My compiler doesn't seem to recognise the type 'FILE' throwing this error at that line, and of course i have included stdio.h in the header
error: expected specifier-qualifier-list before '(' token
Basically I'm writing a program which spawns a a series of child process, taking turns to read lines from a file and inserting them into a circular buffer where they are read by a another set of child processes, encrypted and written to a new file (line by line). It is a requirement that the parent open and closes the file.
I'm permitted to use globals for this but want to avoid it if possible, thanks for any replies. =]