Thread: converting scan codes to ascii codes

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    140

    converting scan codes to ascii codes

    no c library functions please, just how to do it?

    thanks

  2. #2
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    #include <conio.h>
    #include <stdio.h>


    int main(void)
    {
    int a;
    a = getch();
    printf("%d",a);
    return 0;
    }


    it shows you what the ascii code for the input letter is is.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    140
    No ****, thats not what I mean. I want to convert a scan code into an ascii code, Im wondering if there is any straight forward way and no C library functions please.

  4. #4
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212

    Angry

    No problem

  5. #5
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    whoa ! stupid_mutt - i dont think that was called for - brian was only trying to help!
    Monday - what a way to spend a seventh of your life

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    140
    Sorrt, but doesnt anybody know how?

  7. #7
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    I don't know. But why don't you want to use C library functions? Why create something like getch() by yourself?

  8. #8
    Registered User
    Join Date
    Sep 2001
    Posts
    140
    Writing some os indepedent code and it would be nice to know how, I can read scan codes, I just dont know how to convert em to ascii so I can display them.
    Acos is good

  9. #9
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >Writing some os indepedent code

    As far as I know C and it's standard libraries are OS independant.

    >and it would be nice to know how, I can read scan codes, I just >dont know how to convert em to ascii so I can display them.

    I see. Can you tell me what scan codes are? I guess it is the codes which are send by the keyboard when pressing a key, in that case you should do some port reading. They aren't just the numbers of the ASCII characters?

  10. #10
    Registered User
    Join Date
    Sep 2001
    Posts
    140
    You are correct about what scan codes are but no they are not ascii codes. No, the C standard library is not os independent and even if it were getch is part of conio which is not part of the standard C library standard. Please only reply if you can help me.

  11. #11
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    Relax. I was just gaining some information in order to be able to answer your question. Since English isn't my first language, I sometimes need some more explanation of terms.

    http://www.c-for-dummies.com/lessons/bonus/07/

  12. #12
    Registered User
    Join Date
    Sep 2001
    Posts
    140
    Sorry, I forgot too mention I dont really want to use bios stuff, I just want to know an algorithm for converting it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 03:27 AM
  2. Question about ASCII codes
    By rwmarsh in forum C++ Programming
    Replies: 4
    Last Post: 04-17-2006, 10:49 AM
  3. Converting ascii to integer without using atoi
    By sansuki in forum C++ Programming
    Replies: 9
    Last Post: 03-30-2005, 07:38 AM
  4. Getting ASCII codes
    By moonwalker in forum C Programming
    Replies: 3
    Last Post: 07-24-2002, 01:17 PM
  5. ASCII Codes
    By drdroid in forum C++ Programming
    Replies: 11
    Last Post: 05-02-2002, 04:00 PM