Reputation: 15
And the two functions are:
void readFromFile(char file[], int antal_varor, struct storagemanipulation
*inventory)
{
Upvotes: 0
Views: 41
Reputation: 30926
fp==fopen("minFil.txt","r")
This is the bug.
fp=fopen("minFil.txt","r")
will be the correct way.
You can do it simply like this
fp=fopen("minFil.txt","r");
if( fp == NULL ){
// error
}
else{
// do cool stuff
}
This is much more readable. Less error prone.
Also op is writing to the same file from which content was read. maybe the file where it is to be written is different.
Upvotes: 3