How to write a String variable in file.txt in SD card of nextion intelligent series

Hi all;

I spend a long time to find a solution to write a string variable in file.txt in an sd card with the function FileStream but I couldn’t, I tried with this example,“sd0/file.txt”) fs0.write(“textexample”,0,11) fs0.close(),
I got no error but this code doesn’t work, please someone can help me.


I am looking for related information.

I have seen this reply.

Your code will work if your text file already has a size of at least 11bytes (eg 11 spaces). Hope this will help you.

But in fact, I don’t know of any more helpful way than adding 11 space keys.

That’s exactly what I’m looking for.

it’s solved ,thank you very much for your help

Did you use any other method to make the text file size bigger? I’d really like to know. thanks.


I did exactly what you said, I created a file and I write 11 spaces and i tread to write with a variable that has 5 characters (if the variable is bigger than 11 you got a china language) so it works.