-2

I'm trying to run a md5sum command and save the output in C, what is the most efficient way to do it?

Sam
  • 7,252
  • 16
  • 46
  • 65
Carlos Gomez
  • 79
  • 3
  • 10
  • It is a good habit to search stack overflow before you post something here. Not voting down though because it is your #SOFirstTime – sjsam Dec 12 '15 at 18:17

1 Answers1

1

S.Iquebal deleted answer is giving the right way. Use some library functions to compute the md5sum (without running any command) - see md5 openssl functions, since running a command has some overhead.

If you insist on running a command, run it with popen(3) or do the equivalent pipe + fork + execve syscalls(2)

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547