X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "arizvi" Newsgroups: comp.os.msdos.djgpp Subject: Problems with read Date: 23 May 2005 11:31:48 -0700 Organization: http://groups.google.com Lines: 20 Message-ID: <1116873108.011235.255970@g43g2000cwa.googlegroups.com> NNTP-Posting-Host: 66.245.99.113 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1116873113 10654 127.0.0.1 (23 May 2005 18:31:53 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Mon, 23 May 2005 18:31:53 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse AT google DOT com Injection-Info: g43g2000cwa.googlegroups.com; posting-host=66.245.99.113; posting-account=Se-Idg0AAAC00LEpjdiQS7ZeyWGDYpCA To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, I am opening a file and reading from it using the read function in libc. I require 512 bytes, but the number of bytes returned from read is apparently random. I know that I am not at the EOF. The return values (no. of bytes read) I get are either 66 or 432 depending on the file opened. What can be the problem with the function? Should I try to keep reading until I get 512 bytes? The code outline is: filedes = open(filename, O_RDONLY); //open file seekres = lseek(file, offset, SEEK_SET); //seek to offset - 0 cnt = read(filedes,buf, 512); //read 512 bytes: returns < 512 Thanks, Ahmad