This is one of my favorite papers since it involved assembly and C++.  This paper was originally submitted on IBM Developer Works website.  Sadly I can not find the paper there anymore.  

Cross platform programming considerations for C

  For what its worth, I now use the method shown in archlinux wiki.  This can still apply since it handles the problem where you want to ensure a particular usb drive is always mounted at the same point in the file system.