J
jackassplus
I'm sure that strcpy has been beaten to death, but:
I have a program:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]){
if (argc > 1){
if (strlen(argv[1])!=3){
printf("Argument must be 3 characters long");
return 1; //arbitrary value
}
char temp[40] = {}; //this should be large enough
strcat(temp,strcat("[A-Z]{2}[0-9]{3}",argv[1]));
printf("%s\n",temp);
strcat(temp,"[0][0-9]{4}");
printf("%s\n",temp);
}
return 0;
}
output :
Q:\DJGPP\test>test WEM
[A-Z]{2}[0-9]{3}WEM
[A-Z]{2}[0-9]{3}WEMEM
The first line is how I expect it, the second is not. could anyone
shed light on why this is not working as I expext it to?
I have a program:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]){
if (argc > 1){
if (strlen(argv[1])!=3){
printf("Argument must be 3 characters long");
return 1; //arbitrary value
}
char temp[40] = {}; //this should be large enough
strcat(temp,strcat("[A-Z]{2}[0-9]{3}",argv[1]));
printf("%s\n",temp);
strcat(temp,"[0][0-9]{4}");
printf("%s\n",temp);
}
return 0;
}
output :
Q:\DJGPP\test>test WEM
[A-Z]{2}[0-9]{3}WEM
[A-Z]{2}[0-9]{3}WEMEM
The first line is how I expect it, the second is not. could anyone
shed light on why this is not working as I expext it to?