Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

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


Download

 
  #include <string.h>
  #include <stdio.h>
 
  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;
  }
----------------------------------------------------------------------------

No comments yet.

Leave a Comment