I having a strange problem when I try and read out of a file, and then write back into it.
In one function, I'm reading it using:
but later on in another function I'm doing
FILE *fp = fopen(args,r);
and then using x = fgetc
These file pointers are in seperate functions and neither one of them gets passed to the other function.
FILE *fp1 = fopen(args,w);
and then writing to it
The problem is when I try to run it, it crashes, and the only way to solve the problem is to then change both the 'r' and 'w' to 'rw'
For some reason this then means that I can't seem to write to the file at all.
It's acting very strange, especially as the operations are done in seperate functions. It doesn't seem to like me having different file permissions from seperate pointers.
Can anyone give me any ideas as to how this sort of issue is resolved, or where I'm likely to be going wrong?