Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

printing a set of files

Posted on 2000-03-02
9
Medium Priority
?
277 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 22

Accepted Solution

by:
nietod earned 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

730 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