Client/server: running "nano editor" command from client

230 views Asked by At

I have a client/ server program written i c language, a client can send and receive .txt documents to the server, i wish to Open the file received to visualize it with command nano For example, inside the running process:

Something like this: Exec( nano, "file-to-Open.txt") but i dont know how to do do this), can You help me?

Sorry For my english Thank's a lot

1

There are 1 answers

1
chqrlie On BEST ANSWER

Try this:

execlp("nano", "nano", "file.txt", NULL);

The nano editor must be in your path, the file.txt must be in the current directory of the running client process, and most importantly, whatever display the editor is going to display on must be accessible, be it the terminal from where the client is run or the appropriate X-Windows display.