Archived

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

Ziyx

VC++ <fstream>

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
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