Convert Character Variable to Integer Variable

Discussion in 'VHDL' started by Brad Smallridge, Nov 18, 2004.

  1. How do you convert a character variable to an integer variable?

    variable my_char_v : character;
    variable file_size : integer;

    .. . .

    file_size := ???? my_char_v;
    Brad Smallridge, Nov 18, 2004
    #1
    1. Advertising

  2. Brad Smallridge wrote:
    > How do you convert a character variable to an integer variable?
    > variable my_char_v : character;
    > variable file_size : integer;
    >
    > file_size := ???? my_char_v;



    file_size := character'pos(my_char_v);


    -- Mike Treseler
    Mike Treseler, Nov 18, 2004
    #2
    1. Advertising

  3. > file_size := character'pos(my_char_v);

    Yeah that worked. Now one would think that'd
    only work to convert to a character.
    Brad Smallridge, Nov 18, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. les ander
    Replies:
    4
    Views:
    876
    wes weston
    Oct 5, 2004
  2. Replies:
    16
    Views:
    2,288
    Dave Thompson
    Mar 3, 2006
  3. Polaris431
    Replies:
    8
    Views:
    755
    SM Ryan
    Dec 4, 2006
  4. Replies:
    3
    Views:
    496
    James Kanze
    Nov 18, 2007
  5. Xianwen Chen

    Convert an integer value to ASCII character

    Xianwen Chen, Feb 13, 2011, in forum: C Programming
    Replies:
    9
    Views:
    4,708
    alphareaper
    Oct 31, 2012
Loading...

Share This Page