OT: search and replace chars in string with C++

Started by
11 comments, last by penetrator 21 years, 2 months ago
these are the errors shown when i include

:\programmi\microsoft visual studio\vc98\include\ostream(106) : error C2535: ''class std::basic_ostream<_E,_Tr> &__thiscall std::basic_ostream<_E,_Tr>::operator <<(int)'' : member function already defined or declared
c:\programmi\microsoft visual studio\vc98\include\ostream(66) : see declaration of ''<<''
c:\programmi\microsoft visual studio\vc98\include\ostream(272) : see reference to class template instantiation ''std::basic_ostream<_E,_Tr>'' being compiled
c:\programmi\microsoft visual studio\vc98\include\ostream(106) : error C2535: ''class std::basic_ostream > &__thiscall std::basic_ostream >::operator <<(int)'' : member function alr
eady defined or declared
c:\programmi\microsoft visual studio\vc98\include\ostream(66) : see declaration of ''<<''
c:\programmi\microsoft visual studio\vc98\include\ostream(373) : see reference to class template instantiation ''std::basic_ostream >'' being compiled
c:\programmi\microsoft visual studio\vc98\include\ostream(106) : error C2535: ''class std::basic_ostream > &__thiscall std::basic_ostream >:
:operator <<(int)'' : member function already defined or declared
c:\programmi\microsoft visual studio\vc98\include\ostream(66) : see declaration of ''<<''
c:\programmi\microsoft visual studio\vc98\include\ostream(379) : see reference to class template instantiation ''std::basic_ostream >'' being compiled
c:\programmi\microsoft visual studio\vc98\include\istream(103) : error C2535: ''class std::basic_istream<_E,_Tr> &__thiscall std::basic_istream<_E,_Tr>::operator >>(int &)'' : member function already defined or declared
c:\programmi\microsoft visual studio\vc98\include\istream(67) : see declaration of ''>>''
c:\programmi\microsoft visual studio\vc98\include\istream(423) : see reference to class template instantiation ''std::basic_istream<_E,_Tr>'' being compiled
c:\programmi\microsoft visual studio\vc98\include\istream(103) : error C2535: ''class std::basic_istream > &__thiscall std::basic_istream >::operator >>(int &)'' : member function a
lready defined or declared
c:\programmi\microsoft visual studio\vc98\include\istream(67) : see declaration of ''>>''
c:\programmi\microsoft visual studio\vc98\include\istream(544) : see reference to class template instantiation ''std::basic_istream >'' being compiled
c:\programmi\microsoft visual studio\vc98\include\istream(103) : error C2535: ''class std::basic_istream > &__thiscall std::basic_istream >:
:operator >>(int &)'' : member function already defined or declared
c:\programmi\microsoft visual studio\vc98\include\istream(67) : see declaration of ''>>''
c:\programmi\microsoft visual studio\vc98\include\istream(564) : see reference to class template instantiation ''std::basic_istream >'' being compiled
Error executing cl.exe.

fly.obj - 6 error(s), 0 warning(s)


Advertisement
your including the headers multiple times.

ie, in one header, say, "files.h" you might include ostream.h

but in another, you may include ostream.h and files.h... this screws somethings up.
and is exactly what precompiled headers avoid (and a whole lot more)


anyway.

to find and replace in a string is easy,

see:

void FileIO::findReplace(char * string, char find, char replace){   int ref=-1;   while (string[++ref])      if (string[ref]==find)          string[ref]=replace;}     


| - Project-X - my mega project.. big things comming soon - | - adDeath - an ad blocker I made - | - email me - |

[edited by - RipTorn on January 20, 2003 8:54:51 AM]
No, including files multiple times won''t cause that - that''s what inclusion guards are guarding against.
I can only guess at the problem here, but are you including <iostream.h>? Change that to <iostream>. The former is several years out-of-date.

This topic is closed to new replies.

Advertisement