0

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

iDoc
  • 35
  • 1
  • 5

1 Answers1

1

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.

chqrlie
  • 131,814
  • 10
  • 121
  • 189
  • thank's, i'll try it right now, what you mean with "The nano editor must be in your path" and "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." sorry but i didn't understand – iDoc Jun 13 '15 at 07:11