How to save..

Hey guys, i wanna make a fstream project and i wanted to test something. I've tried this, but gives me a error. This is my code for fstream...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

ofstream ash;

ash.open ("NewPage.html");

if(ash.is_open()){

      
      ash << "Hello world!";
	  ash << richTextBox5->Text;

     
      ash.close();
  }else{

      
  }


I got a different error before when i try to do
 
ash << richTextBox5+".html";


But when i tried this way, i get this error.
Error	1	error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'System::String ^' (or there is no acceptable conversion)	


My includes:
1
2
3
#include <fstream>
#include <Windows.h>
#include <string> 
1
2
3
4
5
6
7
8
using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using std::ofstream;
	using std::string;



Thanks, im still new to C++, i forgot most of it after i graduated from high school lol. But, the teacher only told how to do stuff in cmd, and he said don't use MS Visual studio....


Regards,
Ash


Edit:
I also tried this
ash<< "<body background="richTextBox5" bgproperties=fixed>;


But gets 5 errors.


Error	1	error C2001: newline in constant	
Error	3	error C2143: syntax error : missing ';' before 'string'	 
Error	5	error C2146: syntax error : missing ';' before identifier 'ash'	 	
Error	2	error C2146: syntax error : missing ';' before identifier 'richTextBox5'	 
Error	4	error C3288: 'System::Windows::Forms::RichTextBox ^' : illegal dereference of a handle type	 	
Last edited on
This is CLI/C++ which is kind of an entirely different language from normal C++. It's like MS's own version of C++ that they tweaked around to make it work with the .NET framework.

I can't really be of any help to you here. Maybe someone with C++/CLI experience can chime in.
closed account (DSLq5Di1)
Yup and its a monster. I would recommend you work with native C++ or switch to C#.

Regarding your string problem:-
http://stackoverflow.com/questions/1300718/c-net-convert-systemstring-to-stdstring
Topic archived. No new replies allowed.