Probleme de Compilation de la STL
( sur Visual C++ 6 )
Je cherche a utiliser un petit prog qui cherche un mot (rapidement) dans un fichier.
Je suis a peu pres sur que le code qu on m a proposer est bon mais j ai des erreurs de compilation.
Voici le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| #include <fstream>
#include <iterator>
#include <string>
#include <iostream>
using namespace std;
void main()
{
std::ifstream in("LM1-4.txt");
std::string c ( (std::istreambuf_iterator<char>(in)) , (std::istreambuf_iterator<char>()));
std::string::size_type p = c.find("30P");
if (p != std::string::npos){cout<<"bon";}
} |
Et voici le log:
c:\s-labat\standard\standard.cpp(13) : error C2061: syntax error : identifier 'in'
c:\s-labat\standard\standard.cpp(13) : error C2066: cast to function type is illegal
c:\s-labat\standard\standard.cpp(13) : error C2059: syntax error : ','
c:\s-labat\standard\standard.cpp(16) : error C2065: 'c' : undeclared identifier
c:\s-labat\standard\standard.cpp(16) : error C2228: left of '.find' must have class/struct/union type
Aparemment, il comprend pas la declaration de mon string.
J ai vraiment besoin de ce code (celui que j ai fait etait bien trop lent), donc si vous voyez le truc...