Passing Hex...

This is a discussion on Passing Hex... within the C++ Programming forums, part of the General Programming Boards category; Sorry for the simple question... How would I pass a hex-value through a function? I mean, what type would I ...

  1. #1
    Join Date
    Aug 2001

    Passing Hex...

    Sorry for the simple question...

    How would I pass a hex-value through a function?
    I mean, what type would I use?

    Currently I have two different functions. One
    is used to change the screen resolution to 13h,
    and the other is to change it back to 03h. I would
    like to only have one function and pass the
    screen-mode through that.

    Instead of (2 seperate functions):

    I would like (1 function):

    int ChangeScreenMode(TYPE ScreenMode);

    What would TYPE be? Does it matter?

    Much Obliged,
    Staying away from General.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    unsigned int is a good bet

    Or any other unsigned integer type will do

    Any signed integer type will probably do for this specific example, but you might get the odd compiler warning if you try and pass a hex value with the most significant bit set (the function will think its a negative value)
    I support as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Vid modes never even come close to FFh, so a short int would actually work fine. An integer is just a particular range of numbers. The base those numbers are in is irrelevant as long as the number is w/ in the range.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ascii to hex and hex to Ascii
    By beon in forum C Programming
    Replies: 1
    Last Post: 12-26-2006, 05:37 AM
  2. Hex Editing help and information please...
    By SG57 in forum C Programming
    Replies: 9
  3. Replies: 11
  4. Replies: 3
    Last Post: 01-23-2006, 06:25 PM
  5. Is binary HEX?
    By Budgiekarl in forum Tech Board
    Replies: 11
    Last Post: 11-23-2003, 08:02 AM
