Solved

printer port communication

Posted on 1997-11-18
9
155 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
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Read  the original post  on Monitis Blog. Hi.  My name is Erik Dietrich, and this is the first time I’ve posted on the Monitis blog.  By way of introduction, I thought it would make sense to talk about my initial experience with Monitis.   Befo…
Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

696 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