Go Down

Topic: [SOLVED] Specific character SD-card (Read 674 times) previous topic - next topic

Positive07

Sep 11, 2011, 08:38 am Last Edit: Sep 11, 2011, 11:24 pm by Positive07 Reason: 1
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: [Select]
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?
void.setup(){
//---Rubikuino---//
}
void.loop(void)

robtillaart


char str[20] = "1234567890";

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

Rob Tillaart

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

Positive07

#2
Sep 11, 2011, 10:11 pm Last Edit: Sep 11, 2011, 11:05 pm by Positive07 Reason: 1

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...  :~ 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  :)


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

PaulS

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).

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy