S
shawn
Hi All,
Am using MSVC6 compiler on a WinXP machine.
Am trying to read a file using std:fstream;
the problem is that Tofstream.is_open() fails and Tifstream.rdstate()
returns "2" which translates to "The system cannot find the file
specified.".
This is really weird because the said file am tring to read exists on
the disk at the required location.
SNIPPET:-
{
std:fstream Tofstream; // ofstream object of the opened file ;
Tifstream.open(szFileName.c_str(), ios::in | ios::binary);
if (Tifstream.is_open())
{
while(Tifstream.good() && !(Tifstream.eof()))
{
///do stuff
}
}
else
{
cerr<<Tifstream.rdstate(); // returns 2;
}
}
Is this a known problem with std:fstream as such ???
Can't I open the file forcefully in some mode say read + write???
does anyone has a better way to open and read the contents of a file ??
Any help in this regard is welcome
cheers
Shawn
Am using MSVC6 compiler on a WinXP machine.
Am trying to read a file using std:fstream;
the problem is that Tofstream.is_open() fails and Tifstream.rdstate()
returns "2" which translates to "The system cannot find the file
specified.".
This is really weird because the said file am tring to read exists on
the disk at the required location.
SNIPPET:-
{
std:fstream Tofstream; // ofstream object of the opened file ;
Tifstream.open(szFileName.c_str(), ios::in | ios::binary);
if (Tifstream.is_open())
{
while(Tifstream.good() && !(Tifstream.eof()))
{
///do stuff
}
}
else
{
cerr<<Tifstream.rdstate(); // returns 2;
}
}
Is this a known problem with std:fstream as such ???
Can't I open the file forcefully in some mode say read + write???
does anyone has a better way to open and read the contents of a file ??
Any help in this regard is welcome
cheers
Shawn