KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been trying to open a file and output text, but I keep getting errors. So I thought I would start at the very beginning and just try opening the file. This is my code: #include <stdio.h> #include <stdlib.h> #define CORRECT_PARAMETERS 3 int main(void) { FILE *file; file = fopen("TestFile1.txt", "r"); if (file == NULL) { printf("Error"); } fclose(file); } When I run the file, "Error" gets printed to the console and that's it. The TestFile1.txt is in the same location as my .exe. How do I fix this?
Tags (comma-separated)
Save Edits
Cancel