Skip to content

Instantly share code, notes, and snippets.

@kotatsumikan
Created April 13, 2010 13:57
Show Gist options
  • Save kotatsumikan/364638 to your computer and use it in GitHub Desktop.
Save kotatsumikan/364638 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define BUFSIZE 1024
int main(int argc, char **argv){
FILE *fp;
int i;
char buf;
char tag[BUFSIZE];
bool flg;
fp = stdin;
for(flg=false,i=0;;){
buf = fgetc(fp);
if(buf == EOF)break;
if(flg == false && buf == '<'){
flg=true;
}else if(flg == true && buf == '>'){
tag[i++] = buf;
tag[i] = '\0';
i=0;
flg=false;
printf("%s\n",tag);
}
if(flg == true){
tag[i++] = buf;
}
}
fclose(fp);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment