i hav written a code in header file under a button in visual studio 2005(windows form application)but i want to include this code under .cpp file.but if i copy this code directly into .cpp file it gives error.may be i hav to define the function prototype in header file and the function definition in cpp.can u pls send me some example to do this for both header and cpp file.pls help me..its urgent
the following is just a little part of the code in .h file:
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
array<Char>^arr;
arr = richTextBox1->Text->ToCharArray();
int imgsize,imgsize1,ht,wdth;
ht=pictureBox1->Image->Height;
wdth=pictureBox1->Image->Width;
imgsize=ht*wdth;
imgsize1=imgsize/8;
int len=richTextBox1->Text->Length;
//array declaration
array< array< int >^ >^ messag= gcnew array< array< int >^ >(imgsize1);
for(int i=0;i<imgsize1;i++)
{ messag[i] = gcnew array<int>(8);
}
int length =richTextBox1->Text->Length;
embed1::Class1 c;
messag = c.chartobin(arr,length,imgsize1); //converts text frm textBox to binary;
//Printing to a file//
FILE *fp1;
if((fp1=fopen("message.txt","wb"))==NULL)
{ printf("\a\nError while creating a file.\nSystem is exiting....");
exit(0);
}
for (int j = 0; j < messag->Length; j++)
{ for(int i=0;i<messag[j]->Length;i++)
{ fprintf(fp1,"%d",messag[j][i]);
}
fprintf(fp1," ");}