title: Simple Virtual Filesystem in C/C++
body: <p>I would like to implement a very simple Virtual Filesystem (VFS) which supports some basic file system operation like fwrite,
  fopen, fput, etc. The VFS is an abstraction layer on top of some concrete OS, e.g. Windows, Linux etc. Assume now, that
  the fopen interface looks something like this</p>
  
  <pre><code>FILE VFS_File_Open( const unsigned char* strFile, int flags );
  </code></pre>
  
  <p>Now I am wondering how I can make in the actual implementation of this interface the distinction about which
  filesystem I am talking to. Is there in C something that tells me on which OS the application is running so that
  I could do something like this: </p>
  
  <pre><code>FILE VFS_File_Open( const unsigned char strFile, int flags )
  {
  int OS = getOSID();
  
  if (0S == 1)
    //implement here the system calls required to open a file on a WIN OS
  else if (OS == 2)
    //implement here the system calls required to open a file on a Linux OS
  etc  
  }
  </code></pre>
  
  <p><strong>EDIT:</strong> </p>
  
  <p>Now I am wondering if anyone knows where I can find the system calls for file operations for Windows? It is easy to find them for Linux but I struggled to find something similar for windows, e.g. I would be interested in the system calls to open a file, write a file, etc.</p>
  
  <p>On another note: The C stdio.h offers a number of stand IO operations like</p>
  
  <pre><code>FILE * fopen (const char *filename, const char *opentype)
  </code></pre>
  
  <p>In other words, I do not have to reimplement the fopen routine in my VFS as the Gnu C library takes care about what OS it is dealing with, is that right? I just have to implement functionality that is not supported by stdio library, e.g. creating directories, which differ from filesystem to filesystem?</p>
  
  <p>Thanks</p>