Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main (void){
- char a[1000];
- FILE *fptr;
- int i=0,j,len;
- if ((fptr=fopen("se.txt","r"))==NULL){
- printf("Error! opening file");
- exit(1); }
- fscanf(fptr,"%[^\0]",a);
- char *token;
- char *search ="#";
- token = strtok(a, search);
- token = strtok(NULL, search);
- while(token!=NULL){
- printf("<");
- i=0;
- if (token[0]==99){
- token[0]=8;
- printf("center> %s </center>",token);
- }
- else if (token[0]==121) {
- token[0]=8;
- printf("!--%s-->\n",token);
- }
- else {
- while (i<strlen(token)){
- if (token[i]==32){
- token[i]=62;
- break;
- }
- i++;
- }
- printf("%s",token);
- switch (token[0]){
- case 'p':
- printf("</p>\n");
- break;
- case 'h':
- printf("</h1>\n");
- break;
- case 'b':
- printf("</b>\n");
- break;
- default :
- break;
- }
- }
- token=strtok(NULL,search);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement