Click here to Skip to main content
15,911,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CHtmlView is a thread ? Pin
Jaime Olivares25-May-05 11:16
Jaime Olivares25-May-05 11:16 
GeneralRe: CHtmlView is a thread ? Pin
Anonymous25-May-05 20:57
Anonymous25-May-05 20:57 
GeneralSliderBar Control Pin
shijuck23-May-05 22:46
shijuck23-May-05 22:46 
QuestionHow to read the floppy sectors when the 0 sector is bad Pin
bghuang23-May-05 22:41
bghuang23-May-05 22:41 
AnswerRe: How to read the floppy sectors when the 0 sector is bad Pin
Bob Stanneveld23-May-05 23:12
Bob Stanneveld23-May-05 23:12 
GeneralRe: How to read the floppy sectors when the 0 sector is bad Pin
bghuang24-May-05 2:06
bghuang24-May-05 2:06 
GeneralRe: How to read the floppy sectors when the 0 sector is bad Pin
Bob Stanneveld24-May-05 2:29
Bob Stanneveld24-May-05 2:29 
Questionofstream writes strings instead of unsigned ints? Pin
Bob Stanneveld23-May-05 21:36
Bob Stanneveld23-May-05 21:36 
Hello,

I have the following code in my application:
<br />
std::ofstream file;<br />
file.open("Test.dat", std::ios::out | std::ios::trunc | std::ios::binary);<br />
<br />
for( unsigned int i = 0; i < 256; i++ )<br />
{<br />
file << static_cast<unsigned char>(i) << i * 100;<br />
}<br />


In my opinion, this should write the every value of the extended ascii table followed by that value multiplied by 100 to a file. Supprisingly, when I open that file in a hex editor (VS6.0) I see that the stream wrote the first values correctly (value 0 through 255), but the values that should follow each number is represented as a string???

I checked everything:<list>
  • basic_ostream has an overloaded operator << for unsigned int's
  • I open the file in binary mode
  • I write an unsigned int
    I'm really confused how the library converts my unsigned int to a string... Confused | :confused:

    [EDIT]
    No has the correct code example
    [/EDIT]

    Blog[^]

  • AnswerRe: ofstream writes strings instead of unsigned ints? Pin
    toxcct23-May-05 21:53
    toxcct23-May-05 21:53 
    GeneralRe: ofstream writes strings instead of unsigned ints? Pin
    Bob Stanneveld23-May-05 23:08
    Bob Stanneveld23-May-05 23:08 
    GeneralRe: ofstream writes strings instead of unsigned ints? Pin
    toxcct23-May-05 23:13
    toxcct23-May-05 23:13 
    GeneralRe: ofstream writes strings instead of unsigned ints? Pin
    Bob Stanneveld24-May-05 0:18
    Bob Stanneveld24-May-05 0:18 
    GeneralRe: ofstream writes strings instead of unsigned ints? Pin
    toxcct24-May-05 0:57
    toxcct24-May-05 0:57 
    GeneralRe: ofstream writes strings instead of unsigned ints? Pin
    Bob Stanneveld24-May-05 2:07
    Bob Stanneveld24-May-05 2:07 
    GeneralRe: ofstream writes strings instead of unsigned ints? Pin
    toxcct24-May-05 2:16
    toxcct24-May-05 2:16 
    GeneralRe: ofstream writes strings instead of unsigned ints? Pin
    Bob Stanneveld24-May-05 2:20
    Bob Stanneveld24-May-05 2:20 
    AnswerRe: ofstream writes strings instead of unsigned ints? Pin
    nm_11424-May-05 11:36
    nm_11424-May-05 11:36 
    GeneralRe: ofstream writes strings instead of unsigned ints? Pin
    Bob Stanneveld25-May-05 2:27
    Bob Stanneveld25-May-05 2:27 
    QuestionHow to stop resizing of spliiter windows Pin
    nripun23-May-05 21:34
    nripun23-May-05 21:34 
    AnswerRe: How to stop resizing of spliiter windows Pin
    Priyank Bolia25-May-05 0:18
    Priyank Bolia25-May-05 0:18 
    GeneralDisplay DIB when I have its handle (HBITMAP) Pin
    ninck23-May-05 21:23
    ninck23-May-05 21:23 
    GeneralRe: Display DIB when I have its handle (HBITMAP) Pin
    Flit24-May-05 2:07
    Flit24-May-05 2:07 
    GeneralRe: Display DIB when I have its handle (HBITMAP) Pin
    ninck24-May-05 4:01
    ninck24-May-05 4:01 
    GeneralCalling VC dll in VB application Pin
    Jangid23-May-05 21:18
    Jangid23-May-05 21:18 
    QuestionWhat are different method to load any image from file Pin
    amrutajoshi23-May-05 21:04
    amrutajoshi23-May-05 21:04 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.