It has been a whlie since I wrote a program, and shamfully I didn't really learn C that well, but I do have background in several programming languages. So now I ran into a problem when coding an assignment.
Problem: My program needs to send unix command from client to server, and on server side, it will execute and output the command into a file and display the file on the client's screen.
where temp is the file that contain the executed unix command.Code:system(cat temp);
It will output the file to the screen, but it only displays the previous executed one. For example, if there are nothing in the file at begining, then if I type "ls", it will display nothing, but if I type "pwd", then it will displays the output of "ls".What do I need to do in order to display right? Thanks in advance.