How to read sting from a SD card

Post here first, or if you can't find a relevant section!
Post Reply
ChPr
Posts: 25
Joined: Thu Jun 20, 2024 8:03 am
Answers: 1

How to read sting from a SD card

Post by ChPr »

Hello everybody,

I have a file on an SD card containing the following lines :

Code: Select all

1;0;1;255;261;2;499;535;3;699;816;1;936
2;1;3;1440
3;551;0;671;738;2;858;0;1;276
4;399;2;519;0;3;120;628;1;1284
5;548;3;668;744;2;864;856;1;976;1022;0;1142
6;499;3;688;141;1;359;759;0;1434
How to do to read this file to get each line in a différent String. for example, if I have :

Code: Select all

String FP[6];
I want to get :

Code: Select all

FP[0] = 1;0;1;255;261;2;499;535;3;699;816;1;936
FP[1] = 2;1;3;1440
FP[2] = 3;551;0;671;738;2;858;0;1;276
FP[3] = 4;399;2;519;0;3;120;628;1;1284
FP[4] = 5;548;3;668;744;2;864;856;1;976;1022;0;1142
FP[5] = 6;499;3;688;141;1;359;759;0;1434
Sincerely.

Pierre.
by GonzoG » Fri Jun 21, 2024 11:23 pm
Read one character (1 byte) until end of line is reached. Usually line ends with "\r", "\n" or "\r\n" characters or end of file, but there can be other characters used to end a line:
https://en.wikipedia.org/wiki/Newline
Go to full post
STM32ardui
Posts: 142
Joined: Mon May 06, 2024 1:46 pm
Answers: 1
Location: Germany

Re: How to read string from a SD card

Post by STM32ardui »

?
Do you have any specific questions?
GonzoG
Posts: 491
Joined: Wed Jan 15, 2020 11:30 am
Answers: 36
Location: Prudnik, Poland

Re: How to read sting from a SD card

Post by GonzoG »

Read one character (1 byte) until end of line is reached. Usually line ends with "\r", "\n" or "\r\n" characters or end of file, but there can be other characters used to end a line:
https://en.wikipedia.org/wiki/Newline
ChPr
Posts: 25
Joined: Thu Jun 20, 2024 8:03 am
Answers: 1

Re: How to read sting from a SD card

Post by ChPr »

GonzoG wrote: Fri Jun 21, 2024 11:23 pm Read one character (1 byte) until end of line is reached. Usually line ends with "\r", "\n" or "\r\n" characters or end of file, but there can be other characters used to end a line:
https://en.wikipedia.org/wiki/Newline
Thank you. I was wrong because I used "\n\r" instead of "\r\n".

Sincerely.

Pierre.
Post Reply

Return to “General discussion”