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
  • 41,632
  • 12
  • 85
  • 103
softwarematter
  • 28,015
  • 64
  • 169
  • 263

0 Answers0