Sorry I am here to disturb you guys again
Writing to SD Card
Moderator: Benj
-
ahmedkhalid
- Posts: 28
- Joined: Mon May 26, 2014 8:51 pm
- Has thanked: 4 times
Writing to SD Card
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?
Sorry I am here to disturb you guys again
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Writing to SD Card
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
ahmedkhalid
- Posts: 28
- Joined: Mon May 26, 2014 8:51 pm
- Has thanked: 4 times
Re: Writing to SD Card
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?
-
kersing
- Valued Contributor

- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Writing to SD Card
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.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
ahmedkhalid
- Posts: 28
- Joined: Mon May 26, 2014 8:51 pm
- Has thanked: 4 times
Re: Writing to SD Card
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! 