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 <[email protected]> wrote:
> // File Handling
> #include<stdio.h>
> #include<stdlib.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);
> printf("\n",ch);
> return 0;
> }
>
> abc contains some text such as "Kicit 44-1 Gokul;peth\0 nagpur"
>
> What should be the output of the program ??
> Explain the solution !!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.