Pages: [1]   Go Down
Author Topic: [SOLVED] Specific character SD-card  (Read 616 times)
0 Members and 1 Guest are viewing this topic.
Trelew Chubut Argentina
Offline Offline
Newbie
*
Karma: 0
Posts: 16
n00b in Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I´m needing to read an specific character on a text. But I just know the position and it is just one character but i don't know what character it is:
"Text.txt":
Code:
9876543210
I need the second character but it is not always the same. Can I get it just with the position? How can I do that?
« Last Edit: September 11, 2011, 04:24:56 pm by Positive07 » Logged

void.setup(){
//---Rubikuino---//
}
void.loop(void)

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13705
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


char str[20] = "1234567890";

char c = str[2];  // copy char on position 2, note arrays start with index 0.

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Trelew Chubut Argentina
Offline Offline
Newbie
*
Karma: 0
Posts: 16
n00b in Arduino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

char str[20] = "1234567890";

char c = str[2];  // copy char on position 2, note arrays start with index 0.
So... this take the character in the second position and put it in a variant called "cahr c" really? and what's "char str [20]"? I don't understand the code completely...  smiley-confuse Thanks for the reply!

P.S.: Sorry for the bad english...


I have been investiagting and I have already understanded it thanks really much you helped me a lot  smiley


Positive07
« Last Edit: September 11, 2011, 04:05:08 pm by Positive07 » Logged

void.setup(){
//---Rubikuino---//
}
void.loop(void)

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So... this take the character in the second position and put it in a variant called "cahr c" really?
No. It takes the character in the 2nd position and puts it in a variable, named c, whose type is char.

Variants are for people who can't be bothered with proper type design.

Quote
what's "char str [20]"
The variable str is an arry, of type char, that can hold 20 elements (19 characters and a terminating NULL).
Logged

Pages: [1]   Go Up
Jump to: