.txt equivalence for mac?

So im in some tutorials that involve file making through c++ using fstream. Simple stuff, and i believe my code works correctly, the problem is that im using a mac therefore making the folder .txt wont work (I am using Xcode for my IDE in case that helps. Would anyone happen to know what format i can use to make simple text folders like i would for windows using .txt?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  #include <iostream>
#include <fstream>

using namespace std;

int main()
{
    ofstream theFile("players.txt");//The code runs successfully, but no folder is made because i dont think mac has a .txt folder type :S
    
    cout << "Enter player's ID, Name, and Money" << endl;
    cout << "press Ctrl+Z to quit\n" << endl;
    
    int id;
    string name;
    double money;
    
    while(cin >> id >> name >> money)
    {
        theFile << id << ' ' << name << ' ' << money << endl;
        
    }
    
    
    return 0;
}


I couldnt find any answers online so maybe ill just have to do these tutorials without practice?
txt isn't a folder, it is a file extension. I would guess that XCode is putting that file in a weird place, but someone with a mac would have to help you there.

I would suggest building/running your programs from the command line, it will be a good skill to have. I would also guess that the output file would be in a more apparent place.
Last edited on
closed account (z05DSL3A)
txt isn't a folder, it is a file extension. I would guess that XCode is putting that file in a weird place, but someone with a mac would have to help you there.

In the Xcode menu, click on Preferences...
In the dialogue box, click on Locations
Look for where the derived data path leads and have a look there.
Topic archived. No new replies allowed.