Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

binary file in c++

				//reading from a binary file
	int r;
	fstream readBinaryFile;
	readBinaryFile.open("Binary file.dat", ios::in | ios::binary);
	if (readBinaryFile.is_open()) {
		readBinaryFile.read((char*)&r, sizeof(r));
		cout << r;
		readBinaryFile.close();
	}
	else cout << "Unable to open file!";
 
PREVIOUS NEXT
Tagged: #binary #file
ADD COMMENT
Topic
Name
6+2 =