Unofficial Nextion/TJC User Forum

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,fs0.open(“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.

thanks.

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.


This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).