Solved

printer port communication

Posted on 1997-11-18
9
148 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rave Reports - Adding a Data Band 1 998
Can you change icon dynamically in Delphi? 3 631
Pass a string reference from one unit to another 8 108
delphi prevent click fast 2 189
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
We need a new way to communicate time sensitive or critical info.   The best part of my role at xMatters is visiting our clients all over the world to learn about how they operate their businesses, share insights that xMatters has gleaned across…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now