dose the file stream no longer work in vc2005
I have vc 2005 with windows sdk and i can't access file with ifstream no matter how i do it!!
The program compils just fine but the files just can't be opened iv done even the simplist read functions but it wont open so i know it is not my code :( iv tryed restarting to see if mabey the file was being use and wasn't closing but still eval anyone know what microsofts bug is here all there programs worked with vc6
Interesting, people complain too often about vs2005 today.
I use vs2005 beta2 and have no issue with opening owriting files.
Try use fopen,fwrite,fread
I use vs2005 beta2 and have no issue with opening owriting files.
Try use fopen,fwrite,fread
Quote:Original post by Red_falconAs it turns out, this is precisely what you shouldn't do.
Try use fopen,fwrite,fread
Anyway, can we actually see your code? That it worked with vc6 is a good indicator that your code is wrong.
yes so i did try fopen from stuio.h file access varables like so this should work
#include <stdio.h>
int main ()
{
FILE * pFile;
pFile = fopen ("myfile.txt","wt");
if (pFile!=NULL)
{
fputs ("fopen example",pFile);
fclose (pFile);
}
return 0;
}
But no it says when i compile warrning the fopen has been depresated oh well there right well it tells me my file is invalade but it is in the same folder propper name wtf is wrong with microsoft these days they use to make top dollor compilers
#include <stdio.h>
int main ()
{
FILE * pFile;
pFile = fopen ("myfile.txt","wt");
if (pFile!=NULL)
{
fputs ("fopen example",pFile);
fclose (pFile);
}
return 0;
}
But no it says when i compile warrning the fopen has been depresated oh well there right well it tells me my file is invalade but it is in the same folder propper name wtf is wrong with microsoft these days they use to make top dollor compilers
iv use code from all kinds of differnt sources but fine here is one that wont work
#include <iostream>
#include <fstream>
using namespace std;
void main()
{
ifstream infile;
infile.open ("test.txt", ios::in);
while (infile.good())
cout << (char) infile.get();
infile.close();
}
#include <iostream>
#include <fstream>
using namespace std;
void main()
{
ifstream infile;
infile.open ("test.txt", ios::in);
while (infile.good())
cout << (char) infile.get();
infile.close();
}
like i said, i use fopen and so on for my tga loader. the code was written under vs2001, then ported to 2003 and now i work with 2005. That its deprecated is not so bad. But it works
well my compiles the source but the files wont open. if you have one that owkrs want to send me some replacement headers hehe jk i think it is deeper seeded then the hearders
Are you sure the file exists in the same directory as the EXE file?
I'll try your code in my VS2005 in a second.
Through their run in the IDE it will look in the project's directory name rather than where the EXE is. So it will be solution then project then Debug or Release. The EXE seems to be put in the debug of the solutions directory.
I wonder if C# for 2005 is different than my 2003...
I'll try your code in my VS2005 in a second.
Through their run in the IDE it will look in the project's directory name rather than where the EXE is. So it will be solution then project then Debug or Release. The EXE seems to be put in the debug of the solutions directory.
I wonder if C# for 2005 is different than my 2003...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement