Solved

printer port communication

Posted on 1997-11-18
9
146 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

705 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

18 Experts available now in Live!

Get 1:1 Help Now