[ECOS] Re: about fdopen

Fano Ramparany Fano.Ramparany@rd.francetelecom.fr
Mon Mar 26 00:19:00 GMT 2001


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!



More information about the Ecos-discuss mailing list