[SOLVED] Specific character SD-card

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":

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?

char str[20] = "1234567890";

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

robtillaart:
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 :slight_smile:

Positive07

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.

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