conflict using string from <string> and strstr fucntion from <string.h> 
Author Message
 conflict using string from <string> and strstr fucntion from <string.h>

in my main cpp file, I include <string> to declare a
string vector.
However, I find that I must use strstr to find matched
substring. What should I do?

Can I use strstr and include <string.h> in another .cpp
file ?



Tue, 29 Nov 2005 04:44:44 GMT  
 conflict using string from <string> and strstr fucntion from <string.h>

Quote:
> in my main cpp file, I include <string> to declare a
> string vector.
> However, I find that I must use strstr to find matched
> substring. What should I do?

> Can I use strstr and include <string.h> in another .cpp
> file ?

You can do it in the same .cpp file. The two headers are completely
independent. Are you running into any specific problems?
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken



Tue, 29 Nov 2005 04:47:40 GMT  
 conflict using string from <string> and strstr fucntion from <string.h>
Alternatively you could use the find*() members of the string class and stay
away from <string.h>.

Nick


Quote:


> > in my main cpp file, I include <string> to declare a
> > string vector.
> > However, I find that I must use strstr to find matched
> > substring. What should I do?

> > Can I use strstr and include <string.h> in another .cpp
> > file ?

> You can do it in the same .cpp file. The two headers are completely
> independent. Are you running into any specific problems?
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



Tue, 29 Nov 2005 04:59:01 GMT  
 conflict using string from <string> and strstr fucntion from <string.h>
Not yet. one of my friends told me that I couldn't put
two lib in one cpp file. It turns out he is wrong.

Thanks.

Quote:
>-----Original Message-----


>> in my main cpp file, I include <string> to declare a
>> string vector.
>> However, I find that I must use strstr to find matched
>> substring. What should I do?

>> Can I use strstr and include <string.h> in another .cpp
>> file ?

>You can do it in the same .cpp file. The two headers are
completely
>independent. Are you running into any specific problems?
>--
>With best wishes,
>    Igor Tandetnik

>"For every complex problem, there is a solution that is
simple, neat,
>and wrong." H.L. Mencken

>.



Tue, 29 Nov 2005 08:54:22 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Warnings using STL Map<string,string>

2. <<<<<<<Parsing help, please>>>>>>>>

3. using <string> problem

4. Wrong constructor used for vector<string>.

5. Problem using list<string>

6. <<<>>>Need C code advice with functions and sorting.<<<>>>

7. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

8. File Format conversion, ascii freeform -->.csv <-->.wk1<-->dbf<-->?HELP

9. >>>Windows Service<<<

10. CArchive operator<< ambiguous with string literals

11. overriding << for contained std::string

12. vector<string> data loss

 

 
Powered by phpBB® Forum Software