Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Embedded/C question

Embedded/C question

Scheduled Pinned Locked Moved C / C++ / MFC
questionhardwarehelp
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sirrius
    wrote on last edited by
    #1

    I have some code here that I have been playing with to implement a elevator's computer. I have everything kind of mapped out in my head how it's going to work but am having a problem with converting a char to an int. I would like to send the char c to the thread "move( )" and use it as an int. So bacically, How do I convert a char to an int using only djgpp compiler and multi-c operating system. Here is what I am working with. void move(char c) { } void getFloor(void) { DWORD32 timeout; short c; for(;;) { BYTE8 floor; SetCursorPosition(8,10); while(!ScanCodeRdy()) MtCYield(); floor=GetScanCode(); if ( !(floor & 0x80) ) { c=ScanCode2Ascii(floor); PutString(" Floor "); PutChar(c); } } }

    C L 2 Replies Last reply
    0
    • S Sirrius

      I have some code here that I have been playing with to implement a elevator's computer. I have everything kind of mapped out in my head how it's going to work but am having a problem with converting a char to an int. I would like to send the char c to the thread "move( )" and use it as an int. So bacically, How do I convert a char to an int using only djgpp compiler and multi-c operating system. Here is what I am working with. void move(char c) { } void getFloor(void) { DWORD32 timeout; short c; for(;;) { BYTE8 floor; SetCursorPosition(8,10); while(!ScanCodeRdy()) MtCYield(); floor=GetScanCode(); if ( !(floor & 0x80) ) { c=ScanCode2Ascii(floor); PutString(" Floor "); PutChar(c); } } }

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Conversion between int and char is implicit in C++, dunno about C. But surely a cast will do it ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

      J 1 Reply Last reply
      0
      • S Sirrius

        I have some code here that I have been playing with to implement a elevator's computer. I have everything kind of mapped out in my head how it's going to work but am having a problem with converting a char to an int. I would like to send the char c to the thread "move( )" and use it as an int. So bacically, How do I convert a char to an int using only djgpp compiler and multi-c operating system. Here is what I am working with. void move(char c) { } void getFloor(void) { DWORD32 timeout; short c; for(;;) { BYTE8 floor; SetCursorPosition(8,10); while(!ScanCodeRdy()) MtCYield(); floor=GetScanCode(); if ( !(floor & 0x80) ) { c=ScanCode2Ascii(floor); PutString(" Floor "); PutChar(c); } } }

        L Offline
        L Offline
        l a u r e n
        wrote on last edited by
        #3

        what elevator company do u work for? *makes a note not to ride in those elevatots* :rolleyes:


        "there is no spoon"
        biz stuff   about me

        1 Reply Last reply
        0
        • C Christian Graus

          Conversion between int and char is implicit in C++, dunno about C. But surely a cast will do it ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

          J Offline
          J Offline
          John R Shaw
          wrote on last edited by
          #4

          90% of the what is true in C++ is also true in C, minus class support. In other words, the conversion is implicit in C too. Take away class support and the ability to add member functions to structures and what you have is C with much better syntax checking. INTP

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups