LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Print text file in html pages (https://www.linuxquestions.org/questions/programming-9/print-text-file-in-html-pages-253777/)

ariana 11-11-2004 05:05 PM

Print text file in html pages
 
Hi,
I have a log text file that writes each log message in one line. However, the length of the message can not be pre-determined. I need to print this file in html pages each of which has the same number of messages, i.e 50 or 100 using C code. Is there any effective way or library available on the internet I can use? I am appreciated of any suggestion.


Ariana

Mara 11-12-2004 03:18 PM

Which language you'd like to use? When a line end is a separator, it's not that hard. Pseudocode below
Code:

char c;
int count=0;
int max=50;
while(file_not_empty(file)){
    c=getchar(file);
    if(c=='\n'){
        count++;
        if(count==max){
            close_file(outfile);
            /* open new one or exit */
        } else{
            write_line_ending_html_code(outfile);
        }
    } else writetofile(outfile,c);
}



All times are GMT -5. The time now is 11:58 PM.