Add args test

This commit is contained in:
daleclack 2021-09-23 07:38:25 +08:00
parent ca67793ac5
commit 8ed08c158c
1 changed files with 13 additions and 0 deletions

13
c/args.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc,char **argv){
const char * src = *argv;
int len = strlen(src); //argv[0]
char * tmp = malloc(len);
strncpy(tmp,src,len-4);
printf("%s\n",tmp);
free(tmp);
return 0;
}