Bonjour,

Voila j'ai un �norme (enfin tou tdu moins d�routant) probl�me sur un truc aussi idiot que la lecture d'un fichier

Le fichier "essai" que je veux lire contient 10 fois cette m�me ligne :
"abcdefghijklmnopqrstuvwxyz"

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
#include <iostream>
#include <fstream>
using namespace std;
 
int main () 
{
  ifstream inVF("essai", ios::in);
  inVF.seekg(0, ios::beg );
  long position = 0;
  while(!inVF.eof())
  {
    string chaineVF;
    position = inVF.tellg();
    getline(inVF, chaineVF);
    cout<<"## chaineVF : "<<chaineVF<<endl;
    cout<<"## position  : "<<position<<endl;
  }
  inVF.close();
  return 0;
}
sortie console :
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
## chaineVF : abcdefghijklmnopqrstuvwxyz
## position  : 0
## chaineVF : ijklmnopqrstuvwxyz
## position  : 36
## chaineVF : hijklmnopqrstuvwxyz
## position  : 63
## chaineVF : ghijklmnopqrstuvwxyz
## position  : 90
## chaineVF : fghijklmnopqrstuvwxyz
## position  : 117
## chaineVF : efghijklmnopqrstuvwxyz
## position  : 144
## chaineVF : defghijklmnopqrstuvwxyz
## position  : 171
## chaineVF : cdefghijklmnopqrstuvwxyz
## position  : 198
## chaineVF : bcdefghijklmnopqrstuvwxyz
## position  : 225
## chaineVF : abcdefghijklmnopqrstuvwxyz
## position  : 252
Je soupconne tr�s fortement le tellg qui vient tout foutre en l'air, car quand je ne l'utilise pas tout ce passe bien, et franchement je vois pas pourquoi l'utilisation de tellg viendrait autant perturb� le getline, je suis perdu ...

Alors si quelqu'un peut m'expliquer clairement d'o� vient le probl�me ca serait sympa, merci