subject

Ihave the following code where i have to replace the "" with the correct argument to run the code. i have no idea what these commands are or what the syntax is due to poor instructors. #include #include #include #include int main(int argc, char *argv[]){int const buf_size=10; int const extra_size=5; int inputfd, outputfd, openflags; mode_t fileperms; ssize_t numread; char buf[buf_size]; char buf1[extra_size]: char* inputfilename="input. txt"; char* outputfilename="output. txt"; inputfd = open(inputfilename, o_rdonly); if (inputfd == -1) printf("opening file %s", inputfilename); openflags = o_creat | o_wronly | o_trunc; fileperms = s_irusr | s_iwusr | s_irgrp | s_iwgrp | s_iroth | s_iwoth; /*rw-rw-rw */outputfd = open(outputfilename, open flags, fileperms); if (outputfd == -1) printf("opening file %s", outputfilename); while ((numread = read(inputfd, buf, buf_size)) > 0){ if (write(outputfd, , numread) ! = numread) printf("couldn't write while buffer"); if (write(outputfd, "extra", ) ! = extra_size) printf("couldn't write while extra buffer"); }if (numread == -1) printf("read"); if(close(inputfd) == -1) printf("close input"); if(close(outputfd) == -1) printf("close output"); inputfd = open(outputfilename, ); if (inputfd == -1) printf("opening file %s", outputfilename); while ((numread = read(inputfd, buf, buf_size)) > 0){ if (write (1, , ) ! = numread) printf("couldn't write whole buffer"); read(inputfd, buf1, 5); }write(1, "\n", 1); if (close(inputfd) == -1) printf("close input"); return(0); }

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:30, relic7391
Is a string of code written to hurt others by damaging or destroying
Answers: 1
image
Computers and Technology, 23.06.2019 03:50, nakeytrag
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria. what am i?
Answers: 2
image
Computers and Technology, 23.06.2019 13:50, mrfishyyyy
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, ryleerose255
Idon’t understand the double8 coding problem. it is java
Answers: 1
You know the right answer?
Ihave the following code where i have to replace the "" with the correct argument to run the code. i...

Questions in other subjects:

Konu
Chemistry, 05.06.2021 15:20