Integers

This is a discussion on Integers within the Windows Programming forums, part of the Platform Specific Boards category; This is my problem int i; i = sizeof(num); I need to take the value of integer i and display ...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    42

    Integers

    This is my problem


    int i;
    i = sizeof(num);


    I need to take the value of integer i and display it in a message box, but when i try this


    MessageBox(i);


    I get an error


    How can i display integers


    Marky_Mark
    Last edited by Marky_Mark; 11-26-2001 at 04:24 PM.

  2. #2
    Registered User (TNT)'s Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    339
    Hi,

    If you look at the MessageBox() Function you would see that it takes a string param, not an int.

    So you need to put your int into a string then use the message box function.

    A bit like this...

    [code]

    int mynum = 666;
    char mybuffer[10];

    wsprintf(mybuffer, "%d", mynum);

    //note the code!! not 1 param
    MessageBox(hWnd, mybuffer, "HELLO Gr8 Day!", MB_ICONERROR);

    Hope you can adapt that.

    Cheers
    TNT
    TNT
    You Can Stop Me, But You Cant Stop Us All

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assignment HELP!!
    By cprogrammer22 in forum C Programming
    Replies: 35
    Last Post: 01-24-2009, 01:24 PM
  2. Integers into array.
    By livestrng in forum C Programming
    Replies: 10
    Last Post: 10-29-2008, 11:35 PM
  3. Replies: 8
    Last Post: 10-24-2005, 11:26 AM
  4. Scanning integers from a file:
    By xarmenx in forum C Programming
    Replies: 6
    Last Post: 11-29-2004, 03:57 PM
  5. Replies: 6
    Last Post: 08-04-2003, 10:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21