#9 ingiraxo
Tu cestu sem si uložil do proměnný, ale když jí chci pak použít, tak nastane chyba, že ta proměnná neexistuje.
Pozn.: v poslední části kódu ji převádím do char* kvůli jedné funkci (vstupem je jí jen char*)
String^ text = "Hello World!";
SaveFileDialog^ dialog = gcnew SaveFileDialog();
dialog->Title = "Save custom noise file";
dialog->FileName = "_cst.enc";
dialog->Filter = "Custom noise file(*.enc)|*.enc";
if (dialog->ShowDialog() == ::DialogResult::OK)
{
String^ path = dialog->FileName;
StreamWriter^ sw = gcnew StreamWriter(dialog->OpenFile());
sw->WriteLine(text);
sw->Close();
delete sw;
}
delete dialog;
// zde to hlásí chybe, že path není deklarována
char * path2 = new char[path.size() + 1];
std::copy(path.begin(), path.end(), path2);
path2[path.size()] = '\0'; // don't forget the terminating 0
a výpis chyb je zde:
1>d:\microsoft visual studio 2010\dls-5800_software\dls-5800_software\Form1.h(3757): error C2065: 'path' : undeclared identifier
1>d:\microsoft visual studio 2010\dls-5800_software\dls-5800_software\Form1.h(3757): error C2228: left of '.size' must have class/struct/union
1> type is ''unknown-type''
1>d:\microsoft visual studio 2010\dls-5800_software\dls-5800_software\Form1.h(3758): error C2065: 'path' : undeclared identifier
1>d:\microsoft visual studio 2010\dls-5800_software\dls-5800_software\Form1.h(3758): error C2228: left of '.begin' must have class/struct/union
1> type is ''unknown-type''
1>d:\microsoft visual studio 2010\dls-5800_software\dls-5800_software\Form1.h(3758): error C2065: 'path' : undeclared identifier
1>d:\microsoft visual studio 2010\dls-5800_software\dls-5800_software\Form1.h(3758): error C2228: left of '.end' must have class/struct/union
1> type is ''unknown-type''
1>d:\microsoft visual studio 2010\dls-5800_software\dls-5800_software\Form1.h(3759): error C2065: 'path' : undeclared identifier
1>d:\microsoft visual studio 2010\dls-5800_software\dls-5800_software\Form1.h(3759): error C2228: left of '.size' must have class/struct/union
1> type is ''unknown-type''
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.51
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========