Question: need help on the to do part passing the cmd input to popopen sha5i2sun) 44 1000 31 32 /* The array of names of hash
sha5i2sun) 44 1000 31 32 /* The array of names of hash programs * 33 const string hashProgs[] = ('ndssun", "shalsun", "sha224sum", "sha256sun", "sha384sum", 34 35 / 36 * The function called by a child 37 * @param hashProgName the name of the hash program 38 / 39 vold computeHash(const strings hashProgName) 40 41 char str Received [100]: 42 43 /* The hash value buffer / char hashvalue[HASH_VALUE_LENGTH); 45 46 /* The received file name string */ 47 char fileNameRecy[MAX_FILE_NAME_LENGTH); 48 49 /* Fill the buffer with o's / 50 memset(fileNameRecy, (char)NULL, MAX_FILE_NAME_LENGTH); 51 52 /** TODO: Now, lets read a message from the parent **/ 53 if(read(parent TochtldPlpe[READ_END], strReceived, stzeof(strRecetved)) 61 . For example, sha512 sum fileName. 62 63 string cmdLine(hashProgName); 64 cmdLine + 65 cndLine +- fileNameRecv: 66 67 /* TODO: Open the pipe to the program (specified in endline) 68 using popen() and save the ouput into hashvalue. See popen.cpp for examples using popen. 70 71 72 73 74 75 76 77 FILE" progoutput - popen("ndssun test"); 78 54 sha5i2sun) 44 1000 31 32 /* The array of names of hash programs * 33 const string hashProgs[] = ('ndssun", "shalsun", "sha224sum", "sha256sun", "sha384sum", 34 35 / 36 * The function called by a child 37 * @param hashProgName the name of the hash program 38 / 39 vold computeHash(const strings hashProgName) 40 41 char str Received [100]: 42 43 /* The hash value buffer / char hashvalue[HASH_VALUE_LENGTH); 45 46 /* The received file name string */ 47 char fileNameRecy[MAX_FILE_NAME_LENGTH); 48 49 /* Fill the buffer with o's / 50 memset(fileNameRecy, (char)NULL, MAX_FILE_NAME_LENGTH); 51 52 /** TODO: Now, lets read a message from the parent **/ 53 if(read(parent TochtldPlpe[READ_END], strReceived, stzeof(strRecetved)) 61 . For example, sha512 sum fileName. 62 63 string cmdLine(hashProgName); 64 cmdLine + 65 cndLine +- fileNameRecv: 66 67 /* TODO: Open the pipe to the program (specified in endline) 68 using popen() and save the ouput into hashvalue. See popen.cpp for examples using popen. 70 71 72 73 74 75 76 77 FILE" progoutput - popen("ndssun test"); 78 54
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
