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. Read and Write to TextFile With Visual c++ 6.0 MFC

Read and Write to TextFile With Visual c++ 6.0 MFC

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
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.
  • M Offline
    M Offline
    mikobi
    wrote on last edited by
    #1

    I am using Visual c++ 6.0 MFC, I have a problem to print pay slip on Dot Matrix printer. So I need to write my data on Text File and after Printing it. Clearly, How can I Write to Text File et Print this File After with Visual c ++ 6.0 MFC. Thanks

    R S R 3 Replies Last reply
    0
    • M mikobi

      I am using Visual c++ 6.0 MFC, I have a problem to print pay slip on Dot Matrix printer. So I need to write my data on Text File and after Printing it. Clearly, How can I Write to Text File et Print this File After with Visual c ++ 6.0 MFC. Thanks

      R Offline
      R Offline
      Rane
      wrote on last edited by
      #2

      You can play with files in MFC using CFile class. Below shown code snippet will be of little help: CFile cf_object; cf_object.Open( "c:\\CP\\CP_test.txt", CFile::modeCreate|CFile::modeWrite); char szText[100]; strcpy(szText, "File Write Test"); cf_object.Write (szText,100); Regards, Rane

      1 Reply Last reply
      0
      • M mikobi

        I am using Visual c++ 6.0 MFC, I have a problem to print pay slip on Dot Matrix printer. So I need to write my data on Text File and after Printing it. Clearly, How can I Write to Text File et Print this File After with Visual c ++ 6.0 MFC. Thanks

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

        Look here Print Tutorial[^] and File Tutorial[^] I hope it helps..

        Regards, Sandip.

        1 Reply Last reply
        0
        • M mikobi

          I am using Visual c++ 6.0 MFC, I have a problem to print pay slip on Dot Matrix printer. So I need to write my data on Text File and after Printing it. Clearly, How can I Write to Text File et Print this File After with Visual c ++ 6.0 MFC. Thanks

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

          These guys are fast. Let me add up something that has not been said yet: You can open the port to which the printer is attached (usually LPT1) as a file (just pass LPT1 as the file name to the function which opens or creates the file). You can then just write text to this opened file, and you'll see the printer is printing it out. If you consult with the printer documentation, it must have some specific ASCII command patterns (known as EPSON ESC CODE sequences), which you could follow to get formatted output, such as a receipt. :)

          Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

          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