Hi again,
I have this simple code:
#include <iostream>
#include <fstream>
using namespace std;
int main(void)
{
ifstream in("file.txt");
string line;
while (getline(in, line))
{
cout << line << " starts with char: " << line.at(0) << " " << (int) line.at(0) << endl;
}
in.close();
return 0;
}
which prints:
0.000000 0.000000 0.010909 0.200000 starts with char: 32
A 0.023636 0.000000 0.014545 0.200000 starts with char: A 65
B 0.050909 0.000000 0.014545 0.200000 starts with char: B 66
C 0.078182 0.000000 0.014545 0.200000 starts with char: C 67
...
, 0.152727 0.400000 0.003636 0.200000 starts with char: , 44
< 0.169091 0.400000 0.005455 0.200000 starts with char: < 60
. 0.187273 0.400000 0.003636 0.200000 starts with char: . 46
> 0.203636 0.400000 0.005455 0.200000 starts with char: > 62
/ 0.221818 0.400000 0.010909 0.200000 starts with char: / 47
? 0.245455 0.400000 0.009091 0.200000 starts with char: ? 63
¡ 0.267273 0.400000 0.005455 0.200000 starts with char: � -62
£ 0.285455 0.400000 0.012727 0.200000 starts with char: � -62
¥ 0.310909 0.400000 0.012727 0.200000 starts with char: � -62
§ 0.336364 0.400000 0.009091 0.200000 starts with char: � -62
© 0.358182 0.400000 0.016364 0.200000 starts with char: � -62
® 0.387273 0.400000 0.018182 0.200000 starts with char: � -62
¿ 0.418182 0.400000 0.009091 0.200000 starts with char: � -62
À 0.440000 0.400000 0.012727 0.200000 starts with char: � -61
Á 0.465455 0.400000 0.014545 0.200000 starts with char: � -61
Strange... How can I get really the first character of the string
?
Thanks in advance!