#include <string.h>
#include <stdio.h>
int main(int argc, char *argv[]){
char *buff = (char *)malloc(strlen(argv[1])+1);
if (buff != NULL) {
strcpy(buff, argv[1]);
printf("argv[1] = %s.\n", buff);
}
else {
/* Couldn't get the memory - recover */
}
return 0;
}
#include <stdio.h>
int main(int argc, char *argv[]){
char *buff = (char *)malloc(strlen(argv[1])+1);
if (buff != NULL) {
strcpy(buff, argv[1]);
printf("argv[1] = %s.\n", buff);
}
else {
/* Couldn't get the memory - recover */
}
return 0;
}
Keine Kommentare:
Kommentar veröffentlichen