?
Solved

printer port communication

Posted on 1997-11-18
9
Medium Priority
?
163 Views
Last Modified: 2010-04-16
I must write a program for sending files along printer port. I know only how to send data byte by byte but that's too slow. Is there any other way to send more then byte at a time?
0
Comment
Question by:krispi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 2

Expert Comment

by:omsec
ID: 1216840
Hi...

I don't know whether you mean this, but if you are trying to send data to your printer, check out the unit 'printer.tpu' which comes with Borland/Turbo Pascal. There are some routines to assign a file to the printer's - port.

Another possibilty is to try it with the PORT - Command. You may write in any ports with that command. Check out Borland's online-help for examples on how to use it.

Hoping could a bit help, Omsec
0
 

Author Comment

by:krispi
ID: 1216841
I know that allready about PORT command, and you can't send more then byte at a time.
0
 
LVL 2

Accepted Solution

by:
mitchell042997 earned 200 total points
ID: 1216842
I am not too familiar with writing to the PORT file (I have printed writing to the file 'LPT1' with a text file (which only allows one byte at a time)).  However, I would assume you could use blockread and blockwrite to dump multiple bytes to the printer.

var f:file;
begin
  assing(f,'LPT1');
  rewrite(f,SOME_SIZE);

  blockwrite(f,SOME_POINTER,SOME_SIZE/sizeof(SOME_POINTER^),SOME_WORD);

  close(f);
end.

see if that doesn't do the trick...
0
[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

 

Author Comment

by:krispi
ID: 1216843
Blockread  returns File access denied.
my code:

uses crt;
var f:file;
w:string;
n:word;
begin
w:='what shall i say';
assign(f,'LPT1');
reset(f);
Blockread(F, w,1, n);
close(f);
end.
0
 
LVL 2

Expert Comment

by:mitchell042997
ID: 1216844
Use blockwrite, not blockread...  :)


0
 

Author Comment

by:krispi
ID: 1216845
Yes but i would like to read from port too!!!

0
 
LVL 2

Expert Comment

by:mitchell042997
ID: 1216846
You can't *read* from the printer port.  If you want to find out information about print jobs, printer settings, etc., use interrupts.
0
 

Author Comment

by:krispi
ID: 1216847
What about parallel port? Or is this the same??
0
 
LVL 2

Expert Comment

by:mitchell042997
ID: 1216848
I don't know if it is the same or not.  Try posting a question, and see if you get an answer...
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
Learn how to use the free Acronis True Image app to easily transfer data between iPhones and Android phones.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question