where's the text file output in Xcode?

I am a c++ beginner. I am using Xcode for c++ programming.
However i can't see the file being created on the desktop.(btw i have changed the working directory to desktop).


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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const string extension = ".txt";
  void addstudent()
{
    system("clear");
    cout << "A D D  A  S T U D E N T" << endl;
    cout << "-------------------------------------" << endl;
    
    ofstream fout;
    
    cout << "Enter the course of the student: " << endl;
    cin.getline(st[c].course,20);
    
    cout << "Enter the roll no of the student: " << endl;
    cin >> st[c].rno;
    
    cout << "Enter the name of the student: " << endl;
    cin.getline(st[c].name,40);
    
    cout << "Enter the mobile no of the student: " << endl;
    cin >> st[c].mobileno;
    
    fout.open((st[c].course + st[c].rno + extension).c_str(),ios::app);
    fout << st[c].name;
    fout << st[c].course;
    fout << st[c].rno;
    fout << st[c].mobileno;
    cout << "File Created! " << endl;
    fout.close();
    
    
    
    cout << "Student Added! " << endl;
    c++;
    cout << "Total students added: " << c << endl << endl;
    
    cout << "To add another student press 7" << endl;
    cout << "To go back to main menu press 1" << endl;
    cout << "To logout press 0" << endl;
    
    int choice;
    cin >> choice;
    cin.ignore();
    
    switch (choice)
    {
        case 1: adminmain(); break;
        case 0: access(); break;
        case 7: addstudent(); break;
        default: cout << "Wrong Choice! " << endl; access(); break;
    }
    

    
    cout << "--------------------------------------" << endl;
}
I found the problem.
The following code was to be written after the course and the roll no of the student was entered by the user
In the above code i have written it before.

[code]
fout.open((st[c].course + st[c].rno + extension).c_str(),ios::app);
[code]
Topic archived. No new replies allowed.