Hello,
I am working on a program that takes text and modifies it so it can be printed. It adds lines between paragraphs, page numbers, etc.
I am having problems modifying the actual text. I have an outline:
Code:
#include <stdio.h>
void txt2prt(char *input, char *output);
char *header(int page);
char *footer(int page);
int main(int argc, char *argv[]) {
char *infile = "infile.txt";
char *outfile = "output.txt";
//argc counts executable as 1 arg
if( argc == 2 ) {
infile = argv[1];
}
if( argc == 3 ) {
infile = argv[1];
outfile = argv[2];
}
txt2prt(infile, outfile);
return 0;
}
void txt2prt(char *input, char *output) {
int currentPage = 1;
while(*input){
do(*input
//While read from infile, do header, parse and print and footer
}
char *header(int page) {
char *retStr;
//ADD HEADER AND PAGE NUM TO retStr
return retStr;
}
char *footer(int page) {
char *retStr;
//ADD FOOTER AND PAGE NUM TO retStr
return retStr;
}
I was going to use a series of condition statements to apply the various indents and blank lines, etc. I was just wondering how I would go about modifying the input text (getting the input, and outputting something else)
Cheers,
Larph