Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 09-07-2005, 11:20 AM   #1 (permalink)
Salchester
Salchester
 
Salchester's Avatar
 
Join Date: Jul 2005
Location: In a house
Posts: 230
Salchester is an unknown quantity at this point
Printing Problem!

I have just mastered how to print a file for a program I am making. Only, when it has finished printing, the printer stops without giving me the printout.

It must think there is more to print, but there isn’t. How do I let it know it has finished so I can have the printout.

Many Thanks
Coding Enclosed…

P.s can I print from USB rather than LPT1?

Code:
#include <iostream.h>
#include <iomanip.h>
#include <fstream.h>
#include <conio.h>
#include <ctype.h>
#include <dos.h>

int main (void)
{
  char name[20];
  char house;
  int amount;
  amount = 0;
  ifstream data (".\\data.txt");
  ofstream printer ("LPT1");
  printer << "data.txt" << endl;
  printer << "------------------------------------------" << endl;
  do
  {
    data >> name;
    data >> house;
    printer << name << " ";
    printer << house << endl;
    amount++;
  } while (!data.eof());
  printer << "------------------------------------------" << endl;
  printer << " Records in file: " << amount << endl;
  printer << "------------------------------------------" << endl;
  printer.close(); // is this correct?
  return 0;
}
__________________
Many Thanks, in advance!

Salchester.
The Future Is Here - Are You Ready?
Salchester is offline   Reply With Quote
Old 09-07-2005, 03:32 PM   #2 (permalink)
Locutus
Registered User
 
Join Date: Aug 2005
Posts: 20
Locutus is on a distinguished road
You probably need to send it a form feed, '\f'.

Printing from DOS directly to USB isn't possible as far as I know. However, if you're running in a DOS-box in Windows, it is possible to map an USB printer to an LPT port.
Locutus is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSP code problem j.gohel Java 7 04-15-2005 03:07 PM
Hashing problem jodders Standard C, C++ 1 02-09-2005 02:51 PM
Printing freesoft_2000 Java 0 11-27-2004 12:19 PM
Help debugging a power problem Belisarius Lounge 0 10-25-2003 05:44 PM
Problem printing, please help me laurence10 Java 0 03-11-2003 05:26 PM


All times are GMT -8. The time now is 02:57 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting