![]() |
|
#1
|
|||
|
|||
How to access the printer from a console?I found the following code and used it to access the printer and nothing happens, I tryed it on Windows XP and Windows 98 and still nothing happens.
I've compiled the program using and Microsoft Visuall C++ 6.0 and DEV - C++. I want it to print to a usb printer. I found the code on this page, http://personal.stevens.edu/~ckintala/CPE-360/UsingVC.doc. And when reading the what it says again I think I know what the problem is, although I don't know what I should do! eg "It assumes that the printer is capable of accepting plain text. For example, a PostScript printer will not print unless the data comes through a PostScript printer driver. The code above does not make use of any drivers." CPP / C++ / C Code:
Last edited by LuciWiz : 10-Sep-2006 at 09:02.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|
|
#2
|
|||
|
|||
Re: How to access the printer from a console?I don't play with Microsoft stuff at all but there must be a library to handle printing... Have you had a Google for it?
__________________
Michael Dual Opteron 280 (2 x dual core) with 2Gb RAM, 2x36GB system drives, 2T on 3Ware 9500Mi RAID controller. Running Fedora Core 4. Using Anjuta IDE. Developemnt in C++ with MySQL (via mysql++). |
|
#3
|
|||
|
|||
Re: How to access the printer from a console?I found the following code, it does exactly what I want it to do, it even accesses usb printers! Although there is one thing I want it to do, so my program is finished completely. As you can see it is a demo program, and it prints out the same message repeateadly. Although when I try to modify, it want print what i want, I get no output.
CPP / C++ / C Code:
Although there is one thing I want it to do, so my program is finished completely. As you can see it is a demo program, and it prints out the same message repeateadly. Although when I try to modify, it want print what i want. The only thing I whant it to do print this. If anyone can help to print out the following, it would be much appreciated! printf(" \t\t\t\t\t\t\t\t\t\t\t\t\t DATE: %.2d/%.2d/%.4d",gtm->tm_mday,1+gtm->tm_mon,1900+gtm->tm_year); printf(" TIME: %2d:%02d\n", gtm->tm_hour, gtm->tm_min); cout<<******************************************** "<< endl; cout << "\n\t\t ::: MY SYSTEM :::\n"; cout << "\n***************************************"; cout << "\n\n\n" << endl; cout << " \t\t\t\t\t ***********************************"<< endl; cout << " \t\t\t\t\t * PRINT RECORD *"<< endl; cout << " \t\t\t\t\t ***********************************"<< endl; cout << "\n"; cout << "\n \t\t\t\t\t First Name: "<< firstName; cout << "\n\n \t\t\t\t\t Surname: " << lastName ; cout << "\n\n \t\t\t\t\t Parents: "<< parents ; cout << "\n\n \t\t\t\t\t Address: " << address; cout << "\n\n \t\t\t\t\t Telephone: "<< telephone; cout << "\n\n \t\t\t\t\t Mobile: "<< mobile << endl; The following firstName,lastName,parents,address,telephone and Mobile are all chars! Last edited by LuciWiz : 11-Sep-2006 at 13:53.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|
|
#4
|
|||
|
|||
Re: How to access the printer from a console?I've managed to print out the output I want, although there is one simple thimg I cannot figure out, hout to print in a new line with sprintf
CPP / C++ / C Code:
CPP / C++ / C Code:
|
|
#5
|
|||
|
|||
Re: How to access the printer from a console?[quote=35183] to print in a new line with sprintf
CPP / C++ / C Code:
You could try the same way as you would with printf to a console: CPP / C++ / C Code:
Some output devices may require an explicit '\r', so if the above doesn't work, you could try: CPP / C++ / C Code:
Regards, Dave |
|
#6
|
|||
|
|||
Re: How to access the printer from a console?I've tried them both, instead of moving to a new lineI just get 'sqaures', when I print it out in hardcopy!
|
|
#7
|
|||
|
|||
Re: How to access the printer from a console?I figured it out, I just declared another PRN_buffer, and it prints them out perfectly!
|
Recent GIDBlog
Last Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Printer Anywhere (Beta) Free Download | efi | Computer Hardware Forum | 0 | 05-Sep-2006 06:09 |
| need help with a console menu system | BullBuchanan | CPP / C++ Forum | 6 | 20-Aug-2006 14:46 |
| printer / font color / windows programming | nicolas_qc | MS Visual C++ / MFC Forum | 0 | 03-Jan-2006 23:13 |
| Bloodshed Dev C++ Project Options | JdS | CPP / C++ Forum | 6 | 11-Nov-2005 17:23 |
| Which Printer Do You Recommend ? | onauc | Computer Hardware Forum | 3 | 26-Oct-2005 21:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The