Windows filesystem uses "\" and not "/". Windows API translates "/" into "\".
Microsoft Windows supports both, no matter if it's translated or not. To demonstrate:
Code:
#include <stdio.h>
int main ( void )
{
char word[100];
const char * const filepath = "C:/Documents and Settings/JCK/My Documents/data.txt";
FILE * fdata;
fdata = fopen( filepath, "w+" );
if ( fdata ) {
fputs( "Hello, world! This is a sample text file.\n", fdata );
rewind( fdata );
while ( fscanf( fdata, "%99s", word ) == 1 ) {
printf( "read from file: \"%s\"\n", word );
}
fclose( fdata );
remove( filepath );
}
return 0;
}
/** as expected, the output:
read from file: "Hello,"
read from file: "world!"
read from file: "This"
read from file: "is"
read from file: "a"
read from file: "sample"
read from file: "text"
read from file: "file."
**/
This was compiled with Visual C++ 2005 Express on Windows XP Home SP2.
Filepaths with forward slashes will be opened fine.