Running programs on another computer in C

167 views Asked by At

I am making an FTP in C for learning purposes. I know how to connect to a computer and read/write a file, but I'm having problems with running programs. My idea is to connect to the computer, cd into a directory called Available and run ls -l or dir depending on what type of operating system the computer the client has connected to has. After I run one of the commands I want to be able to list the results on the client's computer. My question is, is this possible and if so what would I do? Thank you for reading.

1

There are 1 answers

2
AudioBubble On

Don't run console commands like that. Use the operating system's API / system calls to enumerate files in the current directory.

Windows: FindFirst/FindNextFile APIs Linux: http://www.cs.cf.ac.uk/Dave/C/node20.html#SECTION002000000000000000000 <-- this should help for linux