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

>>i tried if(*q=="") but it gave an error
use single quotes with a space between them, like this: if(*q==' ')

Or something like this:

if (isspace (*p))
{
    cout << "The character is a space character";
}

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:
http://www.gidnetwork.com/b-58.html
(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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.