Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

printer port communication

Posted on 1997-11-18
9
Medium Priority
?
165 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
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

610 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