Code:
#include <stdio.h>
int main (int argc, char * argv[])
{
FILE * fp = NULL;
int c = 0;
if (argc == 2)
{
if( (fp = fopen(argv[1], "r" )) != NULL)
{
while( (c = fgetc( fp )) != EOF )
{
if( c == '<' )
{
do printf( "%c", c ); while( (c = fgetc( fp )) != EOF && c != '>' );
printf(">\n");
}
}
fclose( fp );
}
else
printf("Error opening file.\n");
}
return 0;
}
Is that what you're looking for?
The command line arguments could be handled a bit better in this example, but it will get a file open for you to do your work.
I created a file, and put this in it:
<b>hmm</b>
and it printed the bold html tags.