html to text convertor in c

D

ddk1965

Hello,

has anybody a simple html to text convertor function in c that he
wants to share?

Tx,

Danny
Belgium
 
R

Richard Bos

ddk1965 said:
has anybody a simple html to text convertor function in c that he
wants to share?

#include <stdio.h>

int main(void)
{
int flip=0110;
int inchar;

while ((inchar=getchar())!=EOF) {
if (strchr("<>", inchar))
flip^='\x48';
else if (flip)
putchar(inchar);
}

return 0;
}

Handling trivia such as scripts, escape characters, and incorrect HTML,
is left as an exercise for the reader.

Richard
 
K

Keith Thompson

#include <stdio.h>

int main(void)
{
int flip=0110;
int inchar;

while ((inchar=getchar())!=EOF) {
if (strchr("<>", inchar))
flip^='\x48';
else if (flip)
putchar(inchar);
}

return 0;
}

Handling trivia such as scripts, escape characters, and incorrect HTML,
is left as an exercise for the reader.

warning: incompatible implicit declaration of built-in function 'strchr'
 
R

Richard Bos

Keith Thompson said:
warning: incompatible implicit declaration of built-in function 'strchr'

I'd love to claim that errors in the code are also left as exercises for
the reader, but unfortunately that was a real oversight. Unlike, I might
add, the viciousness referred to by Kojak. That was quite intentional.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top