| | |
help reading binary into a vector for manipulation?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
If you want to see the binary value of each byte then you will have to convert the bytes yourself because neither c nor c++ has build-in functions to do that (unfortunately). Here is an example program how to do that. You will probably want to leave the vector as an int vector and convert the data only for display purposes.
Last edited by Ancient Dragon; Jul 2nd, 2008 at 7:39 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Mar 2008
Posts: 25
Reputation:
Solved Threads: 0
Thanks Ancient Dragon. I got some advice on how to display the decimal representation.
Turns out the binary is being stored but when I display, it is displaying the encoded version of it. (ascii for text and whatever that is for the jpg).
That is what was confusing me. I thought if I used the binary flag, it would show me the binary.
Now I just need to make an algorithm that encrypts and decrypts the stored data right?
BTW can you tell me what type of encoding is being used for the jpg?
C++ Syntax (Toggle Plain Text)
for(size_t i=0;i<memblock.size();++i) std::cout << int(memblock[i]) << std::endl;
Turns out the binary is being stored but when I display, it is displaying the encoded version of it. (ascii for text and whatever that is for the jpg).
That is what was confusing me. I thought if I used the binary flag, it would show me the binary.
Now I just need to make an algorithm that encrypts and decrypts the stored data right?
BTW can you tell me what type of encoding is being used for the jpg?
>>BTW can you tell me what type of encoding is being used for the jpg?
Google for "jpg file format" and it will tell you the file format.
>>Now I just need to make an algorithm that encrypts and decrypts the stored data right?
Yes, just like the link I posted, but do that algorithm for every byte.
Google for "jpg file format" and it will tell you the file format.
>>Now I just need to make an algorithm that encrypts and decrypts the stored data right?
Yes, just like the link I posted, but do that algorithm for every byte.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Dynamic allocation multi-dim array
- Next Thread: Help with Linked List Project!
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






