Hmm ok, I re-read your previous post and I think it answers my question. Yes, I wanted to convert 8 bits in char directly into an int (the first case that you mention). So then I could just typecast the char into an int?
OK say I did read in the 8 bits as a char. How would I then go about converting that into an integer value? I have a function that converts from binary to integer by taking in a char* or string, but I don't know how I could do it with a char.
Any suggestions?
So there definitely is no way to read in individual bits in a binary file?
I just need to be sure, because I read somewhere that C++ allows bitset operations.
Sorry, what I mean is, a char corresponds to an ASCII character, but there are only about 100 or so ASCII characters that exist. So if the bit encoding doesn't correspond or translate to an ASCII character, wouldn't that mean the bits are lost?
general example:
'1001 1001 = 'A'
But what if...
Hi, any help would be appreciated.
I am opening a binary file using an input filestream, and need to read in the first octet of bits (one byte?) to perform operations on.
Is there any way to just read in 8 bits? I tried doing this by reading in a 'char', but then realised that a char does not...
Hi,
Sorry if this question seems really stupid. For this code I'm reading in a text file containing numbers and retrieving the minimum and maximum numbers. (Each number is on a separate line in random order). I can work out the maximum number but can't work out the minimum number correctly.
Any...
Sorry, maybe if I explain what I'm trying to do it might help a bit.
I basically want to read a text file with times in them.
So:
19.30
20.00
16.00
21.30
19.00
I want to read in each time, find out the earliest and latest times and then increment in half hour blocks from the earliest to the...
Hey thanks for your reply.
You say I already have the length when I declared the array, but I thought that is just setting the size of it. The thing is, can you find out how many elements are being stored in the array? Is there any way to do this just by using an array?
I'm sorry if my...
hi i want to loop through an array and need to get its length, ie. the number of elements stored inside. however, the compiler doesnt like num.length(); it says:
request for members 'length' in 'num', which is of non-aggregate type 'double[10]'.
i have no idea what this means. if anyone could...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.