Hello Arduino World
I have a String like this
String S = "
[Station_URL]
URL_0 = 109.206.96.34:8100
URL_1 = airspectrum.cdnstream1.com:8114/1648_128
URL_2 = us2.internet-radio.com:8050
URL_3 = airspectrum.cdnstream1.com:8000/1261_192
URL_4 = airspectrum.cdnstream1.com:8008/1604_128
URL_5 = us1.internet-radio.com:8105
URL_6 = icecast.omroep.nl:80/radio1-bb-mp3
URL_7 = 205.164.62.15:10032
URL_8 = skonto.ls.lv:8002/mp3
URL_9 = 94.23.66.155:8106";
and would like to read it linefeed by linefeed. How can I do this
pcbbc
July 26, 2020, 8:19am
2
Where is it coming from? Read it a line at a time from wherever it is coming from.
If it’s just a constant string p, split it up yourself.
Robin2
July 26, 2020, 10:10am
3
What Arduino board are you using?
It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. This can happen after the program has been running perfectly for some time. Just use cstrings - char arrays terminated with '\0' (NULL).
...R
gcjr
July 26, 2020, 10:46am
4
here's one approach
output
[Station_URL]
URL_0 = 109.206.96.34:8100
URL_1 = airspectrum.cdnstream1.com:8114/1648_128
URL_2 = us2.internet-radio.com:8050
URL_3 = airspectrum.cdnstream1.com:8000/1261_192
URL_4 = airspectrum.cdnstream1.com:8008/1604_128
URL_5 = us1.internet-radio.com:8105
URL_6 = icecast.omroep.nl:80/radio1-bb-mp3
URL_7 = 205.164.62.15:10032
URL_8 = skonto.ls.lv:8002/mp3
URL_9 = 94.23.66.155:8106
myStrings.cpp (574 Bytes)
myStrings.h (107 Bytes)
Tst.ino (264 Bytes)