can you help me in this (C lang)? -


write program takes 2 command-line arguments. first string; second name of file. program should search file, printing lines containing string. because task line oriented rather character oriented, use fgets() instead of getc(). use standard c library function strstr() search each line string. assume no lines longer 255 characters.

/* @aduaitpokhriyal */ #include <stdio.h>  int main(int argc, char *argv[]) {     char command[100]; /* hope large enough! */     sprintf(command, "grep %s %s", argv[1], argv[2]); /* hope arguments there , valid! */     system(command); /* surely "grep" must use strstr() somewhere */     return 0; } 

Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -