Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- //Removing Block Comment from a given Code.
- int main()
- {
- char a;
- FILE *fp1,*fp2;
- fp1=fopen("new1.txt","r");
- fp2=fopen("new2.txt","w");
- while((a=fgetc(fp1))!=EOF)
- {
- if(a=='/')
- {
- while((a=fgetc(fp1))!=EOF)
- {
- if(a=='*')
- {
- while((a=fgetc(fp1))!=EOF)
- {
- if(a=='*')
- {
- while((a=fgetc(fp1))!=EOF)
- {
- if(a=='/')
- a=fgetc(fp1);
- break;
- }
- break;
- }
- }
- break;
- }
- else
- {
- fputc('/',fp2);
- break;
- }
- }
- }
- fputc(a,fp2);
- }
- fclose(fp2);
- fclose(fp1);
- fp2=fopen("new2.txt","r");
- while((a=fgetc(fp1))!=EOF)
- {
- printf("%c",a);
- }
- fclose(fp2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement