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. How to read/write data from/to USB port ?

How to read/write data from/to USB port ?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
12 Posts 7 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.
  • A ashokbngr

    Reading from USB port.????????:confused::confused::confused::confused: Can anybody help me on how to read the data from USB port. Thanks In Advance Ashok.

    C Offline
    C Offline
    Cedric Moonen
    wrote on last edited by
    #2

    You have to open (using CreateFile) the driver that is associated with the device. Then you can use ReadFile and WriteFile to read or write data to the driver. But it depends also of the kind of device you are using. Can you provide more information ?


    Cédric Moonen Software developer
    Charting control [v1.2 - Updated]

    A 1 Reply Last reply
    0
    • A ashokbngr

      Reading from USB port.????????:confused::confused::confused::confused: Can anybody help me on how to read the data from USB port. Thanks In Advance Ashok.

      G Offline
      G Offline
      GuyM
      wrote on last edited by
      #3

      Well, that depends on the driver for your specific device. If your device's USB driver acts like a serial-port then you need the ReadFile() and WriteFile() (just like in a serial port) Otherwise, you'll have to refer to the documentation/spec of your device ...

      A 1 Reply Last reply
      0
      • G GuyM

        Well, that depends on the driver for your specific device. If your device's USB driver acts like a serial-port then you need the ReadFile() and WriteFile() (just like in a serial port) Otherwise, you'll have to refer to the documentation/spec of your device ...

        A Offline
        A Offline
        ashokbngr
        wrote on last edited by
        #4

        can u please send sample code for this. Thanks In Advance Ashok.

        G 1 Reply Last reply
        0
        • C Cedric Moonen

          You have to open (using CreateFile) the driver that is associated with the device. Then you can use ReadFile and WriteFile to read or write data to the driver. But it depends also of the kind of device you are using. Can you provide more information ?


          Cédric Moonen Software developer
          Charting control [v1.2 - Updated]

          A Offline
          A Offline
          ashokbngr
          wrote on last edited by
          #5

          I am very new to this USB communication. can u please send sample code for this or any links???????? Thanks In Advance Ashok.

          C 1 Reply Last reply
          0
          • A ashokbngr

            I am very new to this USB communication. can u please send sample code for this or any links???????? Thanks In Advance Ashok.

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #6

            ashokbngr wrote:

            can u please send sample code for this or any links????????

            No, because I don't have any information to give a piece of code. What device are you trying to communicate with ?


            Cédric Moonen Software developer
            Charting control [v1.2 - Updated]

            D M 2 Replies Last reply
            0
            • A ashokbngr

              can u please send sample code for this. Thanks In Advance Ashok.

              G Offline
              G Offline
              GuyM
              wrote on last edited by
              #7

              Again, assuming your device's USB driver acts like a regular serial-port : http://www.codeproject.com/system/chaiyasit_t.asp[^] Otherwise ... :confused:

              1 Reply Last reply
              0
              • C Cedric Moonen

                ashokbngr wrote:

                can u please send sample code for this or any links????????

                No, because I don't have any information to give a piece of code. What device are you trying to communicate with ?


                Cédric Moonen Software developer
                Charting control [v1.2 - Updated]

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #8

                Cedric Moonen wrote:

                What device are you trying to communicate with ?

                Come on, Cedric, it's a universal serial device!


                "A good athlete is the result of a good and worthy opponent." - David Crow

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                1 Reply Last reply
                0
                • C Cedric Moonen

                  ashokbngr wrote:

                  can u please send sample code for this or any links????????

                  No, because I don't have any information to give a piece of code. What device are you trying to communicate with ?


                  Cédric Moonen Software developer
                  Charting control [v1.2 - Updated]

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #9

                  Cedric Moonen wrote:

                  What device are you trying to communicate with ?

                  This[^] device!

                  "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                  H 1 Reply Last reply
                  0
                  • M Mark Salsbery

                    Cedric Moonen wrote:

                    What device are you trying to communicate with ?

                    This[^] device!

                    "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                    H Offline
                    H Offline
                    Hamid Taebi
                    wrote on last edited by
                    #10

                    But which Blue or White!


                    WhiteSky


                    R M 2 Replies Last reply
                    0
                    • H Hamid Taebi

                      But which Blue or White!


                      WhiteSky


                      R Offline
                      R Offline
                      Rajesh R Subramanian
                      wrote on last edited by
                      #11

                      LOL. 5.

                      1 Reply Last reply
                      0
                      • H Hamid Taebi

                        But which Blue or White!


                        WhiteSky


                        M Offline
                        M Offline
                        Mark Salsbery
                        wrote on last edited by
                        #12

                        :doh: Still not enough info! Or yellow...

                        "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                        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