Need help with ofstream!

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

#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <vector>

using namespace std;

int main()
{
ofstream outputFile;
outputFile.open("debuginfo.txt");

system("mkdir %appdata%\\DebugConsoleDATA");

char one [300], two [300], three [300], four [300], five [300];
char onet [50], twot [50], threet [50], fourt [50], fivet [50];
char oned [50], twod [50], threed [50], fourd [50], fived [50];
float num1, num2, num3, num4, num5;

char chooseMode [10];

printf("v0.0 Modes: test, normal \n");
printf("Enter mode: \n");

char FileName[] = "debug.txt";
ofstream debug(FileName, ios::out);
debug << "This is a test!  ";



The Code is longer than this, but what I want to do is make a command prompt for users to create a "debug ticket."

MY QUESTION: How do you use my current command (ofstream debug(FileName, ios::out) to save in a certain directory? I want it to be %appdata%\\Debug\\debug.txt. Thanks!

I don't want to use something that looks like this:
1
2
3
std::stringstream stream;
stream << "Output.txt" << std::flush;
std:fstream SaveFile(stream.str().c_str());
Last edited on
Topic archived. No new replies allowed.