Jump to content
  • Advertisement
Sign in to follow this  
alex_dergian

dose the file stream no longer work in vc2005

This topic is 4595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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();
}

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!