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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. cannot convert parameter 1 from 'unsigned int' to 'const char *'

cannot convert parameter 1 from 'unsigned int' to 'const char *'

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 2 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
    ScarberryProd
    wrote on last edited by
    #1

    sry to post this 2x but i figured some ppl wouldnt see it in my other thread. i get this error: cannot convert parameter 1 from 'unsigned int' to 'const char *' Conversion from int type to pointer type requires reinterpret_cast, C-style cast or functions-style cast for this line of code: m_port.AddString(ports.ElementAt(i)); How can i fix this? Thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...

    P 1 Reply Last reply
    0
    • S ScarberryProd

      sry to post this 2x but i figured some ppl wouldnt see it in my other thread. i get this error: cannot convert parameter 1 from 'unsigned int' to 'const char *' Conversion from int type to pointer type requires reinterpret_cast, C-style cast or functions-style cast for this line of code: m_port.AddString(ports.ElementAt(i)); How can i fix this? Thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...

      P Offline
      P Offline
      Pedro Ruiz
      wrote on last edited by
      #2

      It seems that ports.ElementAt if of type unsigned int (number) and must be of type const char * (string). Could you provide the ports structure/class declaration/initialization?

      S 1 Reply Last reply
      0
      • P Pedro Ruiz

        It seems that ports.ElementAt if of type unsigned int (number) and must be of type const char * (string). Could you provide the ports structure/class declaration/initialization?

        S Offline
        S Offline
        ScarberryProd
        wrote on last edited by
        #3

        im usinng the stuff the guy gave me in this thread: Can someone help me with this com port enumarator: http://www.codeproject.com/script/comments/forums.asp?forumid=1647&df=100&select=776802#xx776802xx if the link doesnt work it is just a few posts past this one. im using what he gave me not the link i porvided in the origional message thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...

        P 1 Reply Last reply
        0
        • S ScarberryProd

          im usinng the stuff the guy gave me in this thread: Can someone help me with this com port enumarator: http://www.codeproject.com/script/comments/forums.asp?forumid=1647&df=100&select=776802#xx776802xx if the link doesnt work it is just a few posts past this one. im using what he gave me not the link i porvided in the origional message thank you --------------------- And Like The Wind Our Hero Vanishes Off Into The Distance...

          P Offline
          P Offline
          Pedro Ruiz
          wrote on last edited by
          #4

          Ok. The code in the thread is: tprintf(_T("COM%d\n"), ports.ElementAt(i)); then, port.ElementAt(i) is a number. You have to modify your code in the following way (or similar): char txt[256]; sprintf(txt,"COM%d",ports.ElementAt(i)); m_port.AddString(txt); Regards

          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