[ECOS] about fdopen

ylyuan ylyuan@davform.com
Sun Mar 25 23:04:00 GMT 2001


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