1

How can I make this code, that works in Linux, work in Windows. Ideally I need to have a version of it that works on both platforms.

#include <fcntl.h>
#include <iostream>
using namespace std;

int main()
{
    int mode = O_TRUNC | O_RDWR | O_CREAT;
    int myFilDes;
    myFilDes = open ("/home/user23/data.bin", mode, S_IRUSR | S_IWUSR);
    if(myFilDes < 0)
        cout<<"Create failed!"<<endl;
    close(myFilDes);
}
simonc
  • 40,917
  • 12
  • 82
  • 102
softwarematter
  • 26,673
  • 61
  • 165
  • 257

0 Answers0