0

How can I make a textile in a FLTK executable in main(), so when opening the program, and put text in it? The standard way via ofstream does not work now.
The code I want to elaborate on is on this website:
http://www.fltk.org/strfiles/267/fltk_input.cpp

Now when I add

ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();

in the main() method, there is not made a file into the directory when running the executable. I use

#include <iostream>
#include <fstream>
using namespace std;

at the beginning of the file. Compiling using
fltk-config --compile test.cxx
and
g++ test.cxx fltk-config --cxxflags --ldflags -o test
is already tried.

Does someone know why and how to get it working?

Edited by Dani: Formatting fixed

2
Contributors
2
Replies
35
Views
2 Years
Discussion Span
Last Post by bchinfosieeuw
0

What are the compiler outputs? Are you getting errors? The file "example.txt" should appear in the same directory you run the executable from, not necessarily in the directory where the executable "test" exists. How did you run the executable?

0

The program is compiling normally, without errors. Running the executable by double-clicking on it. It is not a command-line executable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.