How do to SCP from within my C++ program?

J

James Kanze

On 02/18/11 05:00 PM, Adrian wrote:
What the system() function returns is implementation defined. You'll
have to check your system documentation.

Maybe. But both Unix and Windows return the exit code of the
child process, and in both cases, 0 means success (and in both
cases, there are programs which return random exit codes).

The real portability problem is what to put in the string you
pass to system. "ls -lt" will have decidedly different results
on a Unix machine than under Windows (unless you've installed
CygWin and have it in your path). And more complicated commands
may work differently on different flavors of Unix, even without
taking Windows into consideration. Or they may work differently
depending which packages you have installed under Linux, even
without taking different flavors of Windows into consideration.
 
M

Man-wai Chang

One downside of system() the caller doesn't know if the command
succeeded or failed.

Call a script that save the return value? Using system() is the simplest
and immediate solution, until you find a free SCP library.... :)


--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.37
^ ^ 16:56:01 up 4 days 3:06 0 users load average: 1.11 1.07 1.05
ä¸å€Ÿè²¸! ä¸è©é¨™! ä¸æ´äº¤! ä¸æ‰“交! ä¸æ‰“劫! ä¸è‡ªæ®º! è«‹è€ƒæ…®ç¶œæ´ (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa
 
J

J G Miller

But I am posting from comp.lang.c++ and fork() doesn't exist ;-)

What do you mean by fork() does not exist?

The very first line in the original posting stated --

"I'm writing C++ code that is running on a *Solaris* system."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top