Dear Paul, Thanks for your reply, but when I run this program it gives error [Error reading file] and don't read jpg or bmp file.
Could you please assist further. Regards Satish ________________________________ From: Paul Herring <[email protected]> To: [email protected] Sent: Tue, February 9, 2010 5:26:48 PM Subject: Re: [c-prog] How to read jpeg or bmp file in c language? On Tue, Feb 9, 2010 at 11:44 AM, satish uniyal <satishuniyal1@ yahoo.com> wrote: > Dear friends, > > Could you please share, How to read jpeg or bmp file in c language? /** Untested **/ char buff[512]; int r = 0; FILE* fp = fopen("~/mypic. jpg", "rb"); while( fp && (r = fread(buff, sizeof buff, 1, fp) == sizeof buff){ printf("Read in %d bytes\n", r): } if (r > 0 && feof(fp)){ printf("Read in %d bytes\n", r): }else{ printf("Error reading file\n"); } fclose(fp); -- PJH http://shabbleland. myminicity. com/env http://www.chavgang s.com/register. php?referer= 9375 [Non-text portions of this message have been removed]
