Solved

printing a set of files

Posted on 2000-03-02
9
258 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
  • 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

827 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