[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: read system call.
what made u say that ?? plz tell somethin about the
expected o/p & result u got.
one problem with the code is when u printf a string it
should end with a '/0'. but here it may not(ie buff)
if the file contains more than 9 chars. so i think u
r getting some gibrish o/p ??
_d ee p a k_
--- Lakshmi Gopinath <lakbala@xxxxxxxx> wrote:
> Hello Everybody,
> I wrote a simple program to read some data from an
> ordinary text file usng
> the read system call. but it does not seem to be
> working. cud someone pls
> help me out
> int main()
> int fd,count;
> char buff;
> if (fd = (open("/root/data",O_RDONLY,0) < 0))
> printf("\n %s",strerror(errno));
> while(count = (read(fd,buff,sizeof(buff))) > 0)
> printf("\n %s ",buff);
> printf("\n %d",count);
> regards ,
> LIP is all for free speech. But it was created
> for a purpose. Violations of the rules of
> this list will result in stern action.
__d ee p a k__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/