V�rifier qu'un fichier existe (System::String* To Char*)
Voila j'ai besoin de voir si un fichier est valide... Pour cela, je r�cup�re le pathName (qui vient de mon form) sous form de System::String*.
Pour v�rifier la validi�, j'�cit une petite fonction :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| if((_access(file, 0)) != -1 )
{
if(showDialogBox)
MessageBox(NULL, "Existe", "About", MB_OK);
// Pour permission décriture
if( (_access(file, 2)) != -1 )
{
if(showDialogBox)
MessageBox(NULL, "OK for writing", "About", MB_OK);
return true;
}
} |
(il y a un else etc...)
On voit ici que _access a besoin de la variable "file" qui, pour cette fonction, doit �tre un char*.
Pour passer de String* � char* j'ai pas trop mal cherch� et j'ai trouver ceci :
Code:
Char file[] = s_file->ToCharArray();
o� file_S est le System::String*.
Ca ne marche pas... Le compilo me renvoit :
Citation:
error C2664: '_access' : cannot convert parameter 1 from '__wchar_t __gc[]' to 'const char *'
Quelqun aurait*il une id�e pour m'aider ?
Merci de votre aide.
Col.