-1

I would like to run the following OS X command:

md5 <<< 'password'

Password is actually supposed to be a parameter, therefore I would like to know how can I "concatenate / insert" a string into another, just like we can do with printf:

char password[] = "password";
//Something like this:
char command[] = ("md5 <<< '%s'", password);

How is it possible in C?

1 Answers1

-1

strcat I think do the job :char *strcat(char *dest, const char *src).

char res[30]; //malloc would be better
strcpy(res, "md5 <<< ");
strcat(res, password);
king
  • 507
  • 1
  • 4
  • 17