Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Ascii Characters

Status
Not open for further replies.

CalebTemple

Programmer
Jan 30, 2003
5
ZA
I need to open a Posiflex Cash drawer by sending Ascii Character <07> to the POS printer to which it is connected.
How do I send Ascii Characters to an LPT port?

Thanx
 
Hi

I Recommend 2 ya to Write a TextFile the Code, and use the
DOS Command &quot;PRINT LPT1 C:\Open.txt&quot; ;)

If you want something more enlightment:

Just Go and analyze the LinePrint Template (FREE), there is some API's That are Called for writing in LPT ports.

There are Also a Plenty of Funtions in API that does what you're intending:

OpenPrinter
WritePrinter
ClosePrinter

The Recommended for 32bit app is using:
CreateFile

Code:
The CreateFile function creates or opens the following objects and returns a handle that can be used to access the object: 

·	files 
·	pipes 
·	mailslots 
·	communications resources 
·	disk devices (Windows NT only)
·	consoles 
·	directories (open only)

 

HANDLE CreateFile(

    LPCTSTR lpFileName,	// pointer to name of the file 
    DWORD dwDesiredAccess,	// access (read-write) mode 
    DWORD dwShareMode,	// share mode 
    LPSECURITY_ATTRIBUTES lpSecurityAttributes,	// pointer to security attributes 
    DWORD dwCreationDistribution,	// how to create 
    DWORD dwFlagsAndAttributes,	// file attributes 
    HANDLE hTemplateFile 	// handle to file with attributes to copy  
   );

Best Regards



-----
carabez@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top