can't exec ssh in popen()

From: sam (sam.wun_at_authtec.com)
Date: 01/24/05

  • Next message: Larry I Smith: "Re: can't exec ssh in popen()"
    Date: Tue, 25 Jan 2005 00:51:40 +0800
    
    

    Hi,

    I don't know why the following popen does not allow me login ssh:

    #include <stdio.h>

    main()
    {
             FILE *p;
             p = popen("/usr/bin/ssh", "r");
             fprintf(p, "sam@dot.com\n");
             fprintf(p, "mypasswd\n");
             pclose(p);
    }

    # ./a.out
    usage: ssh [-1246AaCfghkNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
                [-D port] [-e escape_char] [-F configfile] [-i identity_file]
                [-L port:host:hostport] [-l login_name] [-m mac_spec] [-o
    option]
                [-p port] [-R port:host:hostport] [user@]hostname [command]

    How can I correct this coding error?

    Thanks
    Sam


  • Next message: Larry I Smith: "Re: can't exec ssh in popen()"