Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

read from command line c

#include <stdio.h>

int main(int argc, char **argv) {
    for (int i = 0; i < argc; ++i) {
        printf("argv[%d]: %s
", i, argv[i]);
    }
}

/*
	[birryree@lilun c_code]$ ./a.out hello there
	argv[0]: ./a.out
	argv[1]: hello
	argv[2]: there
*/
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #read #command #line
ADD COMMENT
Topic
Name
4+2 =