Advertisement

VC++ <fstream>

Started by July 24, 2001 11:54 AM
1 comment, last by Ziyx 23 years, 6 months ago
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
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.txtiFile.close();  
Advertisement
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

This topic is closed to new replies.

Advertisement