I have a question. I am programming a Windows Forms Application (C++) for the first time in Visual Studio 2015 and I want to add a "save" button. I also want to be able to read the data from that "savefile" into a graph.
I have researched a bit as to how I can do that. I found a solution with mysql database, but I would prefer not using a data base. I am hoping to just save them in a .txt file and then be able to read from
that text file.
Can anyone help me please? I am guessing its like a four line code, I am just not able to find it.
I hope someone can help me, thanks
The easiest way (IMO) to use text files is to use one of the "AllText" commands.
(Sorry; I dont't do C++)
string path = @"c:\temp\MyTest.txt";
// This text is added only once to the file. if (!File.Exists(path))
// Create a file to write to.string createText = "Hello and Welcome" + Environment.NewLine;
// This text is always added, making the file longer over time // if it is not deleted.string appendText = "This is extra text" + Environment.NewLine;
// Open the file to read from.string readText = File.ReadAllText(path);
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal