Might i ask another question?
I want to make this work.
fwrite(&userpoint, sizeof(struct point), 3, file);
It seems to work when i keep it in the "main-file".
It creates a new file with a name and takes the input in binary mode, but we have to put all our functions in another file.
I guess this is a problem of me not knowing how to use pointers, but no matter what i try, i get errors like those:
point.c(17): error #2048: Undeclared identifier 'file'.
point.c(17): error #2140: Type error in argument 4 to 'fwrite'; expected 'FILE * restrict' but found 'int'.
I declared "FILE *file" in the main-file.
It might help to know that this is the function call in the main-file
addpoint()
and this how this function looks like in the "functions-file"
struct point addpoint(){}
"fwrite" is used in that "addpoint"-function.
EDIT:
This is my header-prototype for this addpoint-function:
struct point addpoint();
But is can not get it together.
I know that i need to hand over the adress of the pointer, wich would be "&file".
But then i have no idea what to change in the functions-file.
Whenever i try to change sth. it complains about the header-proto, when i adjust the proto, i still wont work.
Anybody knows where my error in reasoning is?
Would be great.