Can someone help me understand how to put paths in programs?

I know how to input and output in a c++ program the basic way i.e

    ifstream f; 
    f.open("stalls.txt"); 

    ofstream of; 
    of.open("output.txt"); 

and then saying of << "blah blah";

However, our lecturer wants us to output using a path i.e

Input from "c:\comp\asg\stalls.txt"

Output to "c:\comp\asg\stalls_output.txt"

He told me to try something like

ofstream outfile ("c:\\comp\\asg1\\output1.txt");

but when I do, the output1.txt is created but the output text file is blank. What can I be doing wrong?

Note: I did write stuff to the output file that should show

My code is:

#include <iostream>

#include <fstream>

using namespace std;

struct Stall {
    string name;
    double income;
    double expenses;
    double net;
};

int main()
{

    double tprofit_loss = 0, most_profit;
    Stall tmp;
    int n = 0;
    Stall Stalls[100];
    bool loop = true;

    ifstream f ("c:\\comp1602\\asg1\\stalls.txt");

    ofstream of ("c:\\comp1602\\asg1\\output1.txt");

    while (loop) {
        f >> tmp.name;

        if (tmp.name == "XXXXXX" || tmp.name == "xxxxxx") {
            loop = false;
            continue;
        }

        f >> tmp.income; // read income from the file
        f >> tmp.expenses; // read expenses from the file

        tmp.net = tmp.income - tmp.expenses;
        tprofit_loss += tmp.net;

        Stalls[n] = tmp;

        n++;
    }

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (Stalls[i].net < Stalls[j].net) {
                Stall tmp = Stalls[i];
                Stalls[i] = Stalls[j];
                Stalls[j] = tmp;
            }
        }
    }

    of << "Stall name\t" 
       << "Net income" << endl;

    for (int i = 0; i < n; i++)
        of << Stalls[i].name << "\t\t" << Stalls[i].net << endl;

    of << "Number of stalls in the bazar were: " << n << endl;
    if (tprofit_loss < 0)
        of << "Total loss of bazar is " << tprofit_loss << endl;
    else
        of << "Total profit of bazar is " << tprofit_loss << endl;

    of << "Stall with most profit is:" << endl;
    most_profit = Stalls[n - 1].net;

    for (int i = n - 1; i >= 0 && Stalls[i].net == most_profit; i--)
        of << Stalls[i].name << endl;

   of << "Stalls with profits: "<<endl;
   for (int i = 0; i < n; i++)
   {
       if ((Stalls[i].net) > 0)
           of << Stalls[i].name << endl;
   }
   of << endl;

    of << "Order:"<<endl;

for (int k = 0; k < n; k++) 
    for (int i = 0; i < n; i++){
        if (Stalls[i].net < 0)
        {
            for (int j = i + 1; j < n; ++j){
                Stalls[j - 1] = Stalls[j];
                }
                n--;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (Stalls[i].net > Stalls[j].net) {
                Stall tmp = Stalls[i];
                Stalls[i] = Stalls[j];
                Stalls[j] = tmp;
            }
        }
    }
    for (int i = 0; i < n; i++)
        of << Stalls[i].name << endl;

    of << endl;
    return 0;
}

and the input file is

Games 2300.00 1000.00

Sweets 900.00 1500.00

Music 1500.00 1000.00

XXXXXX