Frage

hey sorry for bothering if this is a really simple issue, but I can't seem to solve this debug assertion failure after so many different trials.

I'm merely executing the following code. I have tried using fgets, fgetc or even feof to wrap around the fget functions. But I keep getting the debug assertion failed message.

int main(void){
char input[101];

FILE *fp = fopen("addition.txt", "r");
if (fp = NULL){
    perror("Error: ");
} else {
    fgets(input, 101, fp);
}
}

Is there anything that I'm misunderstanding completely wrongly here? Thanks much for reading!

War es hilfreich?

Lösung

You're doing fp = NULL instead of ==

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top