1 year, 5 months ago.

File Pointer gives null value when trying to open file always

include "mbed.h"

  1. include "m3pi.h"
  2. include "XBee.h"
  3. 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?

Be the first to answer this question.