for example:
istringstream ss("hello hi here haha");
string p;
while (iss >> p)
{
if (p == "hello")
statement1;
else if (p == hi)
statement2;
}
here parsing is used so what can b used in c for doing this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is an example code that is your snippet translated to C:
Update I changed the calls of
strtoktostrtok_ras recommended by Adam Rosenfield in the comments.