The below should work also, I use it to print directly to the printer port for a legacy app that prints to multiple ports setup in DOS via a ROSE box and is running in both Foxpro 2.6 and VFP6 (app is half-way converted and running in both versions during conversion process - I separate vfp specific with compiler directives):
*!* Program Name: copytofile.prg
*!* Purpose: copy directly to a printer port
LPARAMETERS cPCFile,cPCPortorPCUNC,lnother
DECLARE INTEGER CopyFile IN KERNEL32.DLL ;
STRING @SourceFileName, ;
STRING @DestFileName, ;
INTEGER bFailIfExists
IF CopyFile(cPCFile,cPCPortorPCUNC,0) # 0
* It was copied successfully
ELSE
* it did not work
ENDIF
* Call this program with any of the following:
* copytoport('C:\MyFile.txt','LPT1:',0)
* copytoport('\\myserver\myshareddirectory\myfile','\\myserver\myprinter',0)
.·*´¨)
.·`TCH
(..·*
010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"