Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

printing a set of files

Posted on 2000-03-02
9
Medium Priority
?
282 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 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.

885 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