Page 1 of 1

Another C++ problem

Posted: Sun Jun 03, 2007 8:28 pm
by LtForce
I've been making one program for weeks when suddenly I realised that I don't know how to scipt save fuction. Please, I desperatly need help!!

Posted: Sun Jun 03, 2007 11:49 pm
by AndyCR
Saving what, a file?

Code: Select all

#include <fstream>

ofstream file("filename.txt");

file << "Some text.\n";

file.close();

Posted: Mon Jun 04, 2007 3:02 am
by psychopath
Shouldn't that be ofstream?

Posted: Mon Jun 04, 2007 6:38 am
by AndyCR
Thanks! :) Fixed.

Posted: Mon Jun 04, 2007 6:49 am
by LtForce
There are lots of EditBoxes(It's where you can write text or numbers). And it would be stupid to fill in those EditBoxes again and agina everytime I run the program. So isn't there pre-made button that does that. I want that when I fill these EditBoxes and close the program and run it again EditBoxes would be filled with same stuff I filled it last time I opened them

Posted: Thu Aug 09, 2007 3:14 pm
by LtForce
AndyCR wrote:Saving what, a file?

Code: Select all

#include <fstream>

ofstream file("filename.txt");

file << "Some text.\n";

file.close();
I've started using VC++ Express edition now and I to use that thing that I've quated again. But where am I supposed to write #include <fstream>?

Posted: Thu Aug 09, 2007 6:14 pm
by paradoxnj
The standard is at the top of your code file. The compiler allows you to put it anywhere though.

Another...

Posted: Wed Aug 29, 2007 10:54 am
by LtForce
I've just downloaded VC++ 2008 9.0 Beta and I'm using it now but I don't think scripting language has changed. So here's my new prob: I want this to happen: when I press button 1 new form(it's called 'Favorites') appears. How do I do that?

Code: Select all

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
		 {
			 Favorites::Activate()
		 }
There's an error in that 'Favorites::Activate()' line. So how should I do it? Must I include some files somewhere? Thanks in advance and if these questions are annoying just tell

Posted: Wed Aug 29, 2007 8:14 pm
by AndyCR
I'm not familiar with .NET, but you're missing a semicolon.

Posted: Wed Aug 29, 2007 10:55 pm
by paradoxnj
AndyCR is correct. When using C++ all statements must end with ;