hi everyone out there
how r u
this is my first time.......coming to the point I wanna ask that I've installed turboc 3.0 and I'm doing file handling this time.....but none of the programs is running.
It always shows me the error "Cannot open the file"
I've tried it out on visualc++ 6.0 and it worked there but I could not find where was the mistake.
So please kindly help me out so that I could be able to work with turboc.
thanx in advance
I'll be glad to u
here's the code
#include "stdio.h"
void main()
{
FILE *fp;
char ch;
int nol=0,noc=0,not=0,nob=0;
fp=fopen("TRY1.C","r");
if(fp==NULL)
{
puts("\nCannot Open File ");
exit();
}
while(1)
{
ch=fgetc(fp);
if(ch==EOF)
break;
noc++;
if(ch==' ')
nob++;
if(ch=='\n')
nol++;
if(ch=='\t')
not++;
}
fclose(fp);
printf("\nNo. of Characters = %d",noc);
printf("\nNo. of blanks = %d",nob);
printf("\nNo. of tabs = ",not);
printf("\nNumber of lines = %d",nol);
}