am I missing something here?
I have the following code and would like to read the data in the file and print in the serial monitor but it is constantly just printing cant read file
I know I’ve got the file path correct as I’ve tested the code in VS
the code runs just fine but it can never “see” the file
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
int main()
{
char str[80];
FILE* filepointer = fopen("C:/Users/user/Desktop/textfile.txt", "r");
if (filepointer == NULL) {
printf("Can't open file\n");
}
else {
while (!feof(filepointer)) {
fscanf(filepointer, "%s", str);
printf("%s ", str);
}
fclose(filepointer);
}
}