Jan 29, 2014 at 9:33pm UTC
Look at something like:
1 2 3 4 5 6 7 8
String ^ file_str = <your stored data> ->Trim();
FileInfo ^ file_info = gcnew FileInfo(file_str);
if (file_info->Exists)
{
// Do your thing here
}
ps when you get time read up on exception handling.
http://msdn.microsoft.com/en-us/library/hh875008.aspx
Last edited on Jan 29, 2014 at 9:52pm UTC by Canis lupus
Jan 29, 2014 at 10:01pm UTC
@JLBorges
Your method works great except I can't get the Error message to show. Other than that it no longer crashes my program , i'm gonna play with it and see if i can fix it, can you help me with the code for that?
Jan 29, 2014 at 10:13pm UTC
You may be running a GUI program without a console.
Try something like
System::Windows::Forms::MessageBox::Show() in place of
System::Console::Write()
1 2
// System::Console::Write( "error: " + e->ToString() + '\n' ) ;
System::Windows::Forms::MessageBox::Show( "error: " + e->ToString() ) ;
or something like that; and likewise for the other messages.
EDIT: Yeah,
MessageBox::Show() . Picked that up from the first post.
Last edited on Jan 29, 2014 at 10:16pm UTC