subject

This assignment will introduce how to incorporate command_line arguments into your program. Until now, if we wanted our program to get data from a user, we had to ask the user for specific input and then capture that input with scanf(). In many cases, we would like the user to enter data at the same time they run the program. For example, when we use the "cp" command to submit our programs, we enter the program name (i. e. cp) along with the file to copy and where to copy it. For example: cp p5.c /home/faculty/skoss/cse121/your_UID
So this assignment is about writing a little utility program called submit, which will make it easier for you to submit your weekly programs. After you create this utility, you can simply type submit, followed by your px. c, and it will be copied to your directory in my account.
For example, to submit p5.c you would type:
./submit p5.c Below is the code for this utility. When you compile it, use the following command: goc extra1.c -o submit
#include #include You need to put int main (int argc, const char *argv[]) "Your Login ID here. char cmd (100); //buffer to hold cp command char path() = "/home/faculty/skoss/cse121/your_lo gin_ID"; sprintf(cmd, "cps ", argv[1], path); system(cmd); // gives the cmd command to the operating system for // execution return 0; To learn more about the functions "sprintf()" or "system()". you can google or man_page them, sprintf() is declared in and system() is declared in

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, uh8hardiek
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
image
Computers and Technology, 23.06.2019 09:20, lovely222
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
image
Computers and Technology, 24.06.2019 07:20, djs1002
Ingrid started speaking about her slide presentation. when she clicked to th"third slide, which had just a picture of an elephant, she forgot what she wassupposed to talk about. what could ingrid do to avoid this situation in thefuture? oa. print handouts for her audience. ob. add presenter's notes to each slide. oc. add a video to each slide. od. save her slide presentation to a flash drive
Answers: 2
image
Computers and Technology, 24.06.2019 11:30, smann211
Convert 11001110(acdd notation) into decimal
Answers: 2
You know the right answer?
This assignment will introduce how to incorporate command_line arguments into your program. Until no...

Questions in other subjects: