Pointer sur la dernière occurence d’un caractère dans une chaîne

Author:


Download

 
  #include 
  #include 
 
  int main(char *argv[] ){
 
	  char *path="c/programs file/office.exe";
 
	  //Trouver le dernier slash dans le chemin'path'
	  char *nom_programme = strrchr( path, '/' );
	if ( nom_programme != NULL )
 
	 // Pointer sur le premier caractère après le slash.
	 nom_programme++;
	else
	 nom_programme = argv[0];
	printf( "Le nom du programme est: %sn", nom_programme );
 
    return 0;
  }