// File Handling
#includestdio.h
#includestdlib.h
int main()
{
unsigned char ch; // I think there is problem somewhere in this
line ! Help !!
FILE *fp;
fp = fopen(abc,r);
if(fp==NULL)
{
printf(Unable to Open);
exit(1);
}
while((ch = getc(fp)!=EOF))
printf(%c,ch);
fclose(fp);
i think i should be like this
while((c=fgetc(fp))!=EOF) and not getc
On Thu, Jul 14, 2011 at 2:41 PM, rShetty rajeevr...@gmail.com wrote:
// File Handling
#includestdio.h
#includestdlib.h
int main()
{
unsigned char ch; // I think there is problem somewhere in this
line ! Help !!
FILE
yeah i just figured it out
On Thu, Jul 14, 2011 at 2:47 PM, rajeev bharshetty rajeevr...@gmail.comwrote:
@Aniket Its getc itself !!
On Thu, Jul 14, 2011 at 2:45 PM, Aniket Dutta aniketdutt...@gmail.comwrote:
i think i should be like this
while((c=fgetc(fp))!=EOF) and not getc
On Thu,
addtion to previous post while((ch=getc(fp))!=EOF) then 2 case will occur
On Thu, Jul 14, 2011 at 3:16 PM, Aniket Dutta aniketdutt...@gmail.comwrote:
2. the value of EOF is an integer which equals -1 (0x)
and not 0xff becoz this is a valid Ascii character
for this reason of
2. the value of EOF is an integer which equals -1 (0x)
and not 0xff becoz this is a valid Ascii character
for this reason of tructation the while loop will always be true.
On Thu, Jul 14, 2011 at 3:13 PM, Aniket Dutta aniketdutt...@gmail.comwrote:
1. in ur program it will
dis s just becoz u ve declared as unsigned char(i.e.) EOF valu is -1 and the
range of ch will be form 0 to 255...so -1 is never reached...dis is
error...if i'm wrong correct me...
//BE COOL// kavi
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks