Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 3 months ago.
Problems with file reading
Hello
I have a problem. I want to read a few lines from a file and attached to a string and then sent to the PC. However, it does not work. He comes in the loop, but the mbed doesn't go back out of the while loop. I tried it with getc and fgetc, in both comes a warning. What can I do?
"pointless comparison of unsigned integer with a negative constant" in file "/main.cpp", Line: 35, Col: 40
Code
while((uebertragenBytes = fgetc(fp)) != EOF) { Bytes += uebertragenBytes; } myled1 = 1; pc.printf("%s", Bytes);
1 Answer
11 years, 3 months ago.
Is uebertragenBytes a signed int? Otherwise it can get into an infinite loop, see: http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048865140&id=1043284351.