0

I can't compile your previous code and run it. If you could actually post the current code that demonstrates the issue you are facing, it would expedite the most correct answer.

0

Ok, here's the full code.

#include <iostream>
#include <fstream>
#include <limits>
#include <bitset>

using namespace std ;

int main()
{
	ofstream filebin ;
	filebin.open("RecordBinaryData.txt") ;

	ifstream file ( "path to binary file" ) ; 
	file >> noskipws ;
	typedef bitset< numeric_limits<unsigned char>::digits > bitset ;
        unsigned char byte ;
	long count = 0 ;
	
	if(filebin.is_open())
	{
		while( file >> byte )
		{
			//cout << bitset(byte) ; // to print bits as it is
			filebin << bitset(byte) ;
			count ++ ;
		}
		const long const_count = count ;
		long arr[const_count] ;

		filebin.close() ;
	}

	else
	{
		cout << "Unable to open the file.\n" ;
	}

cin.get() ;
return 0 ;
}

I have attached the binary file as well.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.