Answers for "c main arguments"

C
2

command line options in c++

// Use command lines

int main(int argc, char *argv[])
{

	for(int i = 1; i < argc; i++){
		if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ){
			printf("Usage: App <options>\nOptions are:\n");
			printf("Option list goes here");
			exit(0);
		}else if(!strcmp(argv[i], "-c") || !strcmp(argv[i], "--custom")){
			printf("argument accepted");
		}else{
			if(i == argc-1){
				break;
			}
			MessageBox(NULL, TEXT("ERROR: Invalid Command Line Option Found: \"%s\".\n", argv[i]), TEXT("Error"), MB_ICONERROR | MB_OK);
		}
	}

	MessageBox(NULL, TEXT("ERROR: No Command Line Option Found. Type in --hep or -h"), TEXT("Error"), MB_ICONERROR | MB_OK);
}
Posted by: Guest on May-13-2020
3

main function in c

int main(int argc, char *argv[])
Posted by: Guest on October-19-2020
0

giving arguments to main function in c

/* main.c */
/* 0 copyright/licensing */
/* 1 includes */
/* 2 defines */
/* 3 external declarations */
/* 4 typedefs */
/* 5 global variable declarations */
/* 6 function prototypes */

int main(int argc, char *argv[]) {
/* 7 command-line parsing */
}

/* 8 function declarations */
Posted by: Guest on September-28-2020
0

command line arguments c

int main(int argc, char* argv[]){/*...*/}
Posted by: Guest on April-06-2020

Code answers related to "C"

Browse Popular Code Answers by Language