char *p=" My name is xyz ";
char *q;
q=strstr(p,"name");//it will return ptr at n of name
now if i want to extract "name" from p i will increment the ptr q and put it in a char array say str[] but
how will i check for space after name so that it stops and shouldn include
is xyz
i tried if(*q=="") but it gave an error

11 Years
Discussion Span
Last Post by John A

thanks a lot for this immense help
can u plz tell alternative of while(!file.eof())
as it gives warning to check the end of file for manipulating file object


Check the return value of your read function like it describes at the end of this article:
(Basically feof() is the same as file.eof().)

[edit] Now I'm confused: are we in C or C++? When I saw you using strstr and char arrays, I assumed we were in C. But file.eof() is C++. Could you say so we know what we're trying to do?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.