Thread: Programming C on Linux

  1. #1
    Registered User
    Join Date
    Sep 2008

    Question Programming C on Linux

    Iam writing a C program, which should use "ssh" to login to another computer execute some steps and logout and come back to my own computer.

    if I use system command eg system ("ssh IP");
    iam able to go to different PC but iam not able to come out as all further system commands dont execute .

    Is their any way I can do it ?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    That's because
    is essentially consisting of:
    if (fork())
    So until "yourcommand here" stops, the current thread is held waiting for the process to finish.

    There are various ways to achieve what you want. One way would be to generate a script-file, copy it to the other machine using scp, and then run the script file on the other machine. This can probably be done in a shell-script rather than using C, but if for whatever reason you feel that C is more appropriate, then it can be done in C too.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thinking of upgrading to linux...
    By Yarin in forum General Discussions
    Replies: 37
    Last Post: 07-24-2009, 11:40 AM
  2. Wireless Network Linux & C Testbed
    By james457 in forum Networking/Device Communication
    Replies: 3
    Last Post: 06-11-2009, 11:03 AM
  3. Dabbling with Linux.
    By Hunter2 in forum Tech Board
    Replies: 21
    Last Post: 04-21-2005, 04:17 PM
  4. installing linux for the first time
    By Micko in forum Tech Board
    Replies: 9
    Last Post: 12-06-2004, 05:15 AM

Tags for this Thread