N
nadz
just looking at this main
int main()
{
ifstream fin("text.txt");
doStuff(fin); //processes the data from text.txt
fin.close();
fin.open("text2.txt");
doStuff(fin); //processes the data from text2.txt
return 0;
}
This isn't the actual text from my code but this is basically what is going
on. It compiles fine with no problems. Then when I run it. The text from
text.txt gets processed with no problems. Then nothing happens with
text2.txt. its compiled on g++ I don't know if it s a compiler thing or
not. Are there flags that I have to change or something to reset fin? I
thought all I had to do was close the old file and open a new one. Any help
would be great on this matter. Also... along the same lines. What do I
have to add in the code below in order to clear the stream and reset it so
that I can read from the same file from the beginning again.
int main()
{
ifstream fin("text.txt");
doStuff(fin); //processes the data from text.txt
//WHAT DO I PUT HERE
doOtherStuff(fin); //processes the data from text.txt in a different way
return 0;
}
Thanks in advance,
Justin
int main()
{
ifstream fin("text.txt");
doStuff(fin); //processes the data from text.txt
fin.close();
fin.open("text2.txt");
doStuff(fin); //processes the data from text2.txt
return 0;
}
This isn't the actual text from my code but this is basically what is going
on. It compiles fine with no problems. Then when I run it. The text from
text.txt gets processed with no problems. Then nothing happens with
text2.txt. its compiled on g++ I don't know if it s a compiler thing or
not. Are there flags that I have to change or something to reset fin? I
thought all I had to do was close the old file and open a new one. Any help
would be great on this matter. Also... along the same lines. What do I
have to add in the code below in order to clear the stream and reset it so
that I can read from the same file from the beginning again.
int main()
{
ifstream fin("text.txt");
doStuff(fin); //processes the data from text.txt
//WHAT DO I PUT HERE
doOtherStuff(fin); //processes the data from text.txt in a different way
return 0;
}
Thanks in advance,
Justin