0

How can I interrupt a running C code, to create a hash of a file in a directory?

So at some point in the C code, I put in some code which will create an md5 hash of a file, such as thisfile.txt?

user1463479
  • 63
  • 1
  • 7

1 Answers1

1

The two parts of your question seem un-related.
If you want to interrupt a running C code, you should use signals. Refer http://beej.us/guide/bgipc/output/html/multipage/signals.html
If you want to create md5, use MD5 APIs which are readily available.
I don't understand the need to generate an interrupt to calculate the hash. Thanks

Manik Sidana
  • 2,005
  • 2
  • 18
  • 29
  • It depends on the OS. If it is Windows, signals are not available. One solution is then [events](http://msdn.microsoft.com/en-us/library/windows/desktop/ms686915(v=vs.85).aspx) by checking if the event is signaled (by another portion of code, maybe a callback or another thread) – Seki Jun 18 '12 at 11:40
  • I did not realise that C did not have a native md5 hashing capability. Does it have any native hashing ability? – user1463479 Jun 18 '12 at 11:55
  • 1
    @user1463479 See http://en.wikipedia.org/wiki/C_standard_library for an overview of C's standard library. It's way smaller and more low-level than what you'd expect from most so-called "scripting" languages. And that's how we like it! :D – unwind Jun 18 '12 at 13:08