Go Down

Topic: undefined reference to `fopen' (Read 74 times) previous topic - next topic

Jean24816

The sketch comes from  :

http://www.cplusplus.com/reference/cstdio/fopen/

Why does he not work?

Code: [Select]

#include <stdio.h>

void setup() {
  FILE * pFile;
  pFile = fopen ("myfile.txt", "w+");
  if (pFile != NULL)
  {
    fputs ("fopen example", pFile);

  }
  fclose (pFile);
}

void loop() {
  // put your main code here, to run repeatedly:

}


Regards,

JPDaviau

SteveMann

Explained here: https://forum.arduino.cc/index.php?topic=81529.msg614512#msg614512

"there is no way for Arduino code to open a file on your PC, and there is no where to store a file on an Ardunio board without something like and SD card shield."

UKHeliBob

Where will the myfile.txt file be located ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up