Monday, November 7, 2011

Word Documents to Text file Using C

Word Documents to Text file Using C language


#include<stdio.h>
#include<conio.h>
 void main()
 {
FILE *pt,*p;
char ch;
clrscr();
pt=fopen("C:\\DOC1.DOC","r");
p=fopen("C:\\e.txt","w");
if(pt==NULL)
{
printf("Can not open the source file");
exit(0);
}
if(p==NULL)
{
printf("Can not open the destination file");
exit(0);
}
while((ch=getc(pt))!=EOF)
{
putc(ch,p);
}
fclose(pt);
fclose(p);
getch();
 }

0 comments:

Post a Comment

You are most welcome for making comments here. I will consider your view and will reply you soon.