Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ziyx

VC++ <fstream>

This topic is 6353 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

Hello, when i created a ifstream object and tried using its read function, i found out it wouldn''t accept a signed or unsigned char* although the MSDN library says it is supposed to. Pls enlighten...thank u i''m using VC++ 6.0

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Please expand... as in post a code snippet, cos we don''t have the foggiest what you''re actually doing.

Are you trying to read in unsigned chars? Are you tryin to us a string of signed/unsigned chars as the file name? Are you following proper syntax? Are you familiar with the debugger?

Just some questions.

  
char myFile[] = "c:\\in.txt";
ifstream iFile( myFile );
iFile.read( 5 ); // read 5 bytes of data from file c:\in.txt

iFile.close();

Share this post


Link to post
Share on other sites
Hello, this is what i did

include
using namespace std;

void main()
{
unsigned char a;
ifstream file;
file.open("try.txt", ios::in | ios::binary);
file.read(&a, 1);
}

Thanks for helping

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!