the code is not working properly its about removing comments //Program to print a file by removing Comments Code: #include<stdio.h> void main() { FILE *fp; char ch; //clrscr(); fp=fopen("temp.txt","r"); while(1) { ch=fgetc(fp); if(ch==EOF) break; else { if(ch=='/'){ ch=fgetc(fp); if(ch=='/') { while(1) { ch=fgetc(fp); if(ch=='\n') goto label; } } if(ch=='*') { while(1) { ch=fgetc(fp); if(ch=='*') { ch=fgetc(fp); if(ch=='/') { while(1) { ch=fgetc(fp); goto label; } } else printf("*"); } } } else printf("/"); } } label:printf("%c",ch); } fclose(fp); }
Mukul.Mangla, I am not deleting your posts, because I want the owner of the forum to see them and ban you. I am closing this thread, meanwhile. To the OP: Read the "Before you make a query" thread and clean up your code by using the code tags. Then we'll think about helping you, even though you have posted all your questions on multiple forums.
I would officially warn you to stop those unwanted posts or your account could get banned. rohit83.ken, you need not have a new thread for your solution to the problem and you can use your other thread - removing comments of type // and /* Also it looks like you seem not getting from the other threads and you seem to be creating multiple threads for the same problem. I am warning you last time or your account could get banned. problem in this code