dose the file stream no longer work in vc2005

Started by
15 comments, last by igni ferroque 18 years, 4 months ago
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
Advertisement
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
-----"Master! Apprentice! Heartborne, 7th Seeker Warrior! Disciple! In me the Wishmaster..." Wishmaster - Nightwish
Quote:Original post by Red_falcon
Try use fopen,fwrite,fread
As it turns out, this is precisely what you shouldn't do.

Anyway, can we actually see your code? That it worked with vc6 is a good indicator that your code is wrong.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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
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();
}
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
-----"Master! Apprentice! Heartborne, 7th Seeker Warrior! Disciple! In me the Wishmaster..." Wishmaster - Nightwish
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
Now you pushed me so far, tha i begin to boot up my laptop to check your code
-----"Master! Apprentice! Heartborne, 7th Seeker Warrior! Disciple! In me the Wishmaster..." Wishmaster - Nightwish
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...
Your code works fine. (Although that should be int main and not void main.)
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

This topic is closed to new replies.

Advertisement