LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-11-2004, 05:05 PM   #1
ariana
LQ Newbie
 
Registered: Feb 2003
Posts: 22

Rep: Reputation: 15
Question 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
 
Old 11-12-2004, 03:18 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
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);
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I watch html pages in text mode (e.g. with the help of Emacs, etc)? kornerr Linux - General 6 03-01-2005 10:30 AM
Cookie Sharing Between CGI generated HTML pages and standard HTML pages rkwhited Linux - Newbie 5 08-15-2004 07:39 AM
C: How can i print out the content of a file in pages? akin81 Programming 1 03-25-2004 08:46 PM
man pages in text file serji Linux - Newbie 6 10-20-2003 03:59 PM
man pages in text file serji Linux - Software 6 10-20-2003 03:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration