There is not platform-independent way of doing it...thus, you need to check what the C run-time or API of the correpsonding operating system has to offer...which one are you using?