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 can I use ReadFile() and WriteFile ()

How can I use ReadFile() and WriteFile ()

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
6 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.
  • A Offline
    A Offline
    Angel Kid
    wrote on last edited by
    #1

    I want to send an recive a CString between COM1 and COM2.How can I use the function ReadFile() and WriteFile()?Can anyone give a example code?thanks very much.;P YES, I am here.

    T V 2 Replies Last reply
    0
    • A Angel Kid

      I want to send an recive a CString between COM1 and COM2.How can I use the function ReadFile() and WriteFile()?Can anyone give a example code?thanks very much.;P YES, I am here.

      T Offline
      T Offline
      Toni78
      wrote on last edited by
      #2

      Writing is easy but reading is not that simple. Check this website [^] for an example. Also search MSDN for serial communications. // Afterall, I realized that even my comment lines have bugs When one cannot invent, one must at least improve (in bed).-My latest fortune cookie

      A 1 Reply Last reply
      0
      • T Toni78

        Writing is easy but reading is not that simple. Check this website [^] for an example. Also search MSDN for serial communications. // Afterall, I realized that even my comment lines have bugs When one cannot invent, one must at least improve (in bed).-My latest fortune cookie

        A Offline
        A Offline
        Angel Kid
        wrote on last edited by
        #3

        thank you .but that is too hard to find what my want. can anyone give me a simple? YES, I am here.

        T L 2 Replies Last reply
        0
        • A Angel Kid

          I want to send an recive a CString between COM1 and COM2.How can I use the function ReadFile() and WriteFile()?Can anyone give a example code?thanks very much.;P YES, I am here.

          V Offline
          V Offline
          valikac
          wrote on last edited by
          #4

          Here is a link to MSDN that shows a good design sample from Microsoft. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn\_serial.asp Kuphryn

          1 Reply Last reply
          0
          • A Angel Kid

            thank you .but that is too hard to find what my want. can anyone give me a simple? YES, I am here.

            T Offline
            T Offline
            Toni78
            wrote on last edited by
            #5

            Angel Kid wrote: that is too hard to find what my want If you read the article that kuphryn gave you, maybe that example won't seem so hard. I agree with you when you say that it is too hard, because I had the same problem when I first saw the example a few years ago, but the thing is that I was unable to find anything more simple. I don't know how comfortable you are with threads because you have to use them. On the other hand just ignore all the stuff that seems complicated to you because you won't need most of it. I wish I could help you with some sample code, but unfortunately I don't have any available. Just take a look at [^] because there are some classes that deal with serial communications. // Afterall, I realized that even my comment lines have bugs When one cannot invent, one must at least improve (in bed).-My latest fortune cookie

            1 Reply Last reply
            0
            • A Angel Kid

              thank you .but that is too hard to find what my want. can anyone give me a simple? YES, I am here.

              L Offline
              L Offline
              louis 0
              wrote on last edited by
              #6

              Look for this article on this site. Read it and implement. Article name : "CSerialCom - A simple Class for Implementing Serial Communication in Win-9X/2000" by SHIBU K.V Good luck. Louis

              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