Tuesday, 29 July 2014

13. A. WRITE A C PROGRAM TO REMOVE ALL WHITE SPACES AND NEWLINE CHARACTERS FROM A FILE



13. A. WRITE A C PROGRAM TO REMOVE ALL WHITE SPACES AND 
NEWLINE CHARACTERS FROM A FILE
SOURCE CODE:

#include <stdio.h>
#include <stdlib.h>
int main(){
FILE *fp,*fp1;
char ch;
fp=fopen("g.txt","r");
fp1=fopen("g2.txt","w");
if(fp==NULL)  {
printf("Some problem in opening the file");
exit(0);
}
else  {
while((ch=fgetc(fp))!=EOF)  {
if(ch==' '|| ch=='\n') {
}
else  {
fprintf(fp1,"%c",ch);
}
}
}
fclose(fp);
return 0;
}

1 comments:

SANA MIR said...

Code white systemNorth American health-care facilities classifies Code White as an event of actual or potential abusive/violent/aggressiv.

Post a Comment

 
- |