This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: about fdopen
- To: ylyuan at davform dot com
- Subject: [ECOS] Re: about fdopen
- From: Fano Ramparany <Fano dot Ramparany at rd dot francetelecom dot fr>
- Date: Mon, 26 Mar 2001 09:56:44 +0200
- CC: ecos-discuss at sources dot redhat dot com
- Organization: France Telecom
- References: <985590295.24130.ezmlm@sources.redhat.com>
- Reply-To: Fano dot Ramparany at rd dot francetelecom dot fr
Why do you want to use fdopen for?
If you want to write into the socket you just have to use the function write.
write(s, <data>, <datalength>)
If you want to read from the socket you just have to use the function read.
read(s,<data>,<datalength>)
Fano
> From: "ylyuan" <ylyuan@davform.com>
> To: "ecos-discuss" <ecos-discuss@sourceware.cygnus.com>
>
> Hi,part of my program is :
> static FILE *sfp;
> if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
> printf("error to creat a socket\n");
> exit(1);
> }
> if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
> printf("error to connect\n");
> exit(1);
> }
> if ((sfp = fdopen(s, "w")) == 0) {
> printf("error to fdopen s\n");
> exit(1);
> }
>
> socket() and connect() are right,but fdopen() can't return,who can tell me why?
> Thanks a lot!