Reputation: 25
I am creating cross platform code(Win and Linux) and in windowsVS the file path is usually used as
"Folder1\\folder2\\file"
where as in gcc it should be '/' in the place of '\'
"Folder1/folder2/file"
Can anyone suggest a way to use that or is there any #define macro that I can use in assigning this.
Although I have tried using
#if __linux__
#define // '\'
#endif
But its throwing an error. Somebody pls help!!
Upvotes: 1
Views: 685
Reputation: 33273
Use /
on both platforms. The C APIs for Windows accept both /
and \
.
Upvotes: 4