I've wanted to start learning more about C++ after been in C# for about 2years.
So I wanted to do this new project into C++ instead, yet I'm struggling so much with such simple idiotic thing, but I can't wrap my head around.
I have a raw file..
The very thing I want is to get the first 4 bytes and display as a int.
That means, show me "65"
I've tried countless things, but can't in a simple way
and the closest I got was using a for loop... definetly not on the simple side...
This displays me "A" thats kinda right, but not what I want
using namespace std;
cout << hex << b;
I was expecting atleast 41, or 41000000 or 00000041
I've tried to cast it as (unsigned int)b, but then it display some random hex numbers..
What am I doing it wrong, is there a simple way to do this at all?
In c# i'd just use.
int i = b.ReadInt32();
//b being a binaryreader stream of the file.