| SpongeCrunch (2) | |
| is there a code in C++ to instruct a program to print a particular file? how? I know how to save data via .txt or via .doc but i don't know how to print it while i'm in the program. | |
|
|
|
| firedraco (5413) | |
| If you are using an fstream, just open it normally then use getline while file.good(), and store the resulting stuff into a array/vector or just print it out as you go. | |
|
|
|
| SpongeCrunch (2) | |
|
This is my sample (draft design): ------------ choose 1 1. print a (file, ex: payroll record) 2. open a (file, ex: payroll record) 3. view a (file, ex: payroll record) 4. edit a (file, ex: payroll record) I chose: _ ------------ so my question is how to print the file while i'm in the program? honestly speaking, i don't have any idea whatsoever, i'm REALLY a newbie. | |
|
Last edited on
|
|
| Default (9) | |
|
I think Firedraco wanted to say this String line; While (!file.eof()){ getline(anyfile,line) cout <<line;} hope this helps. | |
|
Last edited on
|
|
| eker676 (427) | |
|
Do you mean display the text on the screen or actually print out a sheet of paper from the printer? I don't know how to print from the printer but someone else may. | |
|
Last edited on
|
|