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.
5 years, 4 months ago.
File Pointer gives null value when trying to open file always
include "mbed.h"
- include "m3pi.h"
- include "XBee.h"
- include <string>
DigitalOut myled(LED2); Serial xigbee(p28,p27); m3pi bot(p23,p9,p10);
using namespace std;
char msg[] = "xxxx"; char actual_command[] = "";
LocalFileSystem local("local");
int main() { FILE *fp = fopen("/local/bot_data_a.txt","r"); fp = fopen("/local/bot_data_a.txt", "r"); bot.locate(0,1); bot.printf("%s\n", (!fp ? "Fail :(" : "OK"));
/* return 0; }
On execution of the above code Fail since the file pointer becomes null always.
Any help on how to rectify this issue?