-->
Page 1 of 2

Weird create file problem -ESP-12S issue?

PostPosted: Sun Jan 22, 2017 12:28 am
by Xcess
Hi,

I have been using the following very basic code:
file.open("1.txt","w")
file.writeline("this is a test")
file.close()

It used to be just fine. I have been using ESP-12 from AI-THINKER. I got a new ESP-12S and the same code starts to break. The symptom is like this, the first time this code runs. No error at all, but the 1.txt doesn't created! Then I ran the same code again, this time the file.writeline("this is a test") will output the error:

stdin:1: open a file first.

Any ideas?

Thanks in advanced!

Re: Weird create file problem -ESP-12S issue?

PostPosted: Sun Jan 22, 2017 3:12 pm
by martinayotte
Without seeing your whole code, I think you mistakenly didn't have right syntax for open, or it is not Arduino code :

Code: Select allFile file = SPIFFS.open("1.txt","w");
file.writeline("this is a test");
file.close();

Re: Weird create file problem -ESP-12S issue?

PostPosted: Sun Jan 22, 2017 3:57 pm
by RichardS
I had similar issues, then I added / before the filename /1.txt and all OK.....

RichardS

Re: Weird create file problem -ESP-12S issue?

PostPosted: Sun Jan 22, 2017 7:34 pm
by Xcess
RickardS,

Thanks for the tip, but it didn't work for me. maybe the file system is corrupt?

Xcess