For sure there IS a way if you resort to IMPLEMENTATION SPECIFIC approaches.

But you're also saying that it also has to be ANSI-C89, and there is no standard function which is guaranteed to be available on all systems.

The question is, do you want to relax your C89 only requirement and use a platform specific API or not?