Page 1 of 1
Writing to SD Card
Posted: Tue Sep 09, 2014 11:50 pm
by ahmedkhalid
Hello Everyone!!
Sorry I am here to disturb you guys again

. I want to know how I can move to next line of a text editor file using SD/FAT functions?
Re: Writing to SD Card
Posted: Wed Sep 10, 2014 9:47 am
by Benj
Hello,
You would do something like this.
Initialise
OpenFile("file.txt")
LineString = ReadStringFromFile(MaxLength, '\n')
The ReadStringFromFile function will then populate the LineString variable with a line of data read from the file terminating at a new line character.
Re: Writing to SD Card
Posted: Wed Sep 10, 2014 8:33 pm
by ahmedkhalid
Well Thanks for the response! But in my case I have to write into the text file and after writing few bytes I have to move to the next line. How I can do that?
Re: Writing to SD Card
Posted: Wed Sep 10, 2014 9:03 pm
by kersing
To move to the next line for a Windows editor write the string "\r\n" (or the characters '\r' and '\n') at the end of your line.
Re: Writing to SD Card
Posted: Wed Sep 10, 2014 9:04 pm
by ahmedkhalid
Plus one more thing, how can I create a file and write on it simultaneously? Like I created a file and after opening it tried to write something but when the program was executed, during its first execution only a file was created and nothing get written, but when the program was executed again then I was able to write onto the file. So How can I do both the tasks in a single execution cycle? I hope you get my question!
