1

I'm using tinyxml through openframeworks which uses cstdio for file access. I can see the example program quite happily create and write files but there is no delete so my plan is to implement remove, but after trying to run this code in my own project it doesn't seem to create a file or notify me of an error.

This code runs as expected on windows, just not on mac osx 10.8.5, no file is generated.

#include <cstdio>

int main(int argc, const char * argv[])
{
    bool bClosed = false;
    bool bWritten = false;
    FILE* testFile;
    testFile = fopen(".\\test.xml", "w");
    if(testFile)
    {
       bWritten = fputs("test writing.", testFile);
       bClosed = !fclose(testFile);
    }
    return 0;
}

edit: i now know the file exists as can read from it, i just cant view it in finder, i have hidden files shown, its not found its way into the app's package contents.

cool mr croc
  • 743
  • 1
  • 13
  • 31

1 Answers1

2

On a unix-like system (e.g. Mac OS X and Linux) a Windows path as

".\\test.xml"

should rather be

"./test.xml"

Anyway the simplest solution for this case might just be

"test.xml"
Marco A.
  • 41,192
  • 25
  • 117
  • 233