Read and Write to TextFile With Visual c++ 6.0 MFC
-
-
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
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
-
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
Look here Print Tutorial[^] and File Tutorial[^] I hope it helps..
Regards, Sandip.
-
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
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++]