Solved

printing a set of files

Posted on 2000-03-02
9
271 Views
Last Modified: 2010-04-02
How to write a program that print a set of files starting each new one on a new page, with a title and a running page count for each file.
0
Comment
Question by:Lora
[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
  • 6
  • 3
9 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 2576370
What os?
Are these text files?
0
 
LVL 22

Expert Comment

by:nietod
ID: 2576373
Do lines need to be wrapped?
0
 

Author Comment

by:Lora
ID: 2576534
Text files( MS-DOS)
don't need to be wrapped
help me
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 2576687
Then you can open the printer port like a file using an fstream.  Open the text files with an fstream and write lines to the file like.

fstream File("C:\\SOMEFILE.TXT",ios_base::in);
fstream Printer("LPT1",ios_base::out);
const int LinesPerPage = 60;
int PageNum = 1;
int LinCnt = 0;

while (!File.eof())
{
   string Lin;

   getline(Lin,File);
   Printer << Lin << endl;
   ++LinCnt;
   if (LinCnt > LinesPerPage)
   {
       Printer << "page number: " << PageNum;
       Printer << '\f';
       ++PageNum;
       LinCnt = 0;
   }
}
0
 
LVL 22

Expert Comment

by:nietod
ID: 2576692
Let me know if you have any questions.
0
 

Author Comment

by:Lora
ID: 2576860
Please could You help me with this one
Write a program to remove trailing blanks
and tabs from each line of input and delete
entirely blank lines
0
 
LVL 22

Expert Comment

by:nietod
ID: 2577213
Is this for an assignment?
0
 

Author Comment

by:Lora
ID: 2577271
Could You please transform question ?
I am really sorry but I can't understand it
0
 
LVL 22

Expert Comment

by:nietod
ID: 2577548
The questions you are asking seem like they are for an accademic assignment--homework or school project etc.

For ethical reasons we cannot _give_ answers to accademic questions.  We can provide limited assistance, like you might get from a teacher or tudor.  i.e. we can help you work to a solution, but can't give it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

627 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