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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:00
Which is the highest level of the hierarchy of needs model? a. humanity b. intrapersonal c. team d. interpersonal
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
How much current flows through the alternator brushes? a. 2–5 a b. 25–35 a, depending on the vehicle c. 5–10 a d. 10–15 a
Answers: 2
question
Computers and Technology, 23.06.2019 21:00
Which task uses a simple parameter?
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
You know the right answer?
This assignment will introduce how to incorporate command_line arguments into your program. Until no...
Questions
question
Mathematics, 28.07.2021 05:00
Questions on the website: 13722363