I try to read the content of a file and get the tokens from the file. I already implemented so that I got the tokens from the file but the first token was #include and I want to split this token again because I want # as a token and include as other token. So I implement another method to analyze the tokens
how can I get the second char from token? example the token #include. I want to get the first char which is # and save it in a buffer and get the rest token which is include and save it in other buffer.
There are many ways to solve this type of problem. One of the easier ways is using regular expressions (Boost.Regex is one such library).
However, if you really want to do this right, consider using Boost.Spirit or some other library that let's you define a syntax and then perform the lexical analysis.
I already have a method to read each carachter in a file. using for loop with a variable int c. My problem now It doesn't read the charachter underline " _ ".
I just try this but unfortunately it doesn't work.
1 2
if (c == 95) // 95 ANSII its _
cout << "it is underline" << endl;
And it works with the other ANSII code.
can somebody explain to me why? and how can I get the character 95 (underline) in ANSII table?