Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
886 connectés 

  FORUM HardWare.fr
  Programmation
  C

  nom fichier

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

nom fichier

n°1517418
shinohinat​a
Posté le 21-02-2007 à 10:09:40  profilanswer
 

Bonjour,
comment est-ce qu'un programme peut afficher  son nom dans son propre code?
Il me faudrait la syntaxe
merci

mood
Publicité
Posté le 21-02-2007 à 10:09:40  profilanswer
 

n°1517424
_darkalt3_
Proctopathe
Posté le 21-02-2007 à 10:12:07  profilanswer
 

argv[0]


---------------
Töp of the plöp
n°1517460
Emmanuel D​elahaye
C is a sharp tool
Posté le 21-02-2007 à 10:50:40  profilanswer
 


mais ce n'est pas portable...
 


---------------
Des infos sur la programmation et le langage C: http://www.bien-programmer.fr Pas de Wi-Fi à la maison : http://www.cpl-france.org/
n°1517485
_darkalt3_
Proctopathe
Posté le 21-02-2007 à 11:14:59  profilanswer
 

Emmanuel Delahaye a écrit :

mais ce n'est pas portable...


et quelle est donc la manière portable :??:


---------------
Töp of the plöp
n°1517513
Emmanuel D​elahaye
C is a sharp tool
Posté le 21-02-2007 à 11:35:23  profilanswer
 

_darkalt3_ a écrit :

et quelle est donc la manière portable :??:


Il n'y en a pas.

 

argv[0] retourne, selon l'implémentation :

 
  • ""
  • "<nom de l'executable>"
  • "<chemin absolu><nom de l'executable>"

Message cité 1 fois
Message édité par Emmanuel Delahaye le 21-02-2007 à 11:36:05

---------------
Des infos sur la programmation et le langage C: http://www.bien-programmer.fr Pas de Wi-Fi à la maison : http://www.cpl-france.org/
n°1517525
_darkalt3_
Proctopathe
Posté le 21-02-2007 à 11:41:00  profilanswer
 

Ah ok ...
Effectivement j'aurais du préciser cela, je ne savais juste pas pour la chaine vide.
:jap:


Message édité par _darkalt3_ le 21-02-2007 à 11:41:09

---------------
Töp of the plöp
n°1517984
Trap D
Posté le 21-02-2007 à 21:07:54  profilanswer
 

GetModuleFileName mais sous Windows.

n°1518018
Sve@r
Posté le 21-02-2007 à 23:03:34  profilanswer
 

Emmanuel Delahaye a écrit :

  • "<chemin absolu><nom de l'executable>"

C'est plutôt "<chemin avec lequel on a appelé l'exécutable (peut être relatif si on a fait ./prog)><nom de l'exécutable>"...
 


---------------
Vous ne pouvez pas apporter la prospérité au pauvre en la retirant au riche.
n°1518207
nORKy
Grmmph...
Posté le 22-02-2007 à 11:35:09  profilanswer
 

make -DPACKAGE_NAME="monprog" pt etre ?


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C

  nom fichier

 

Sujets relatifs
imprimer un fichier excel depuis visual basic 6parser un fichier html avec php
Upload de fichier sur un disque depuis une page asp.net[Java][Shell] Transfert de fichier par FTP
Supprimer les dernières lignes d'un fichier..
[VBS] supprimer les 2 premiere ligne d'un fichieréxécuter un fichier php à partir d'un autre (avec get)
[OLE]Creation de fichier OOo 
Plus de sujets relatifs à : nom fichier


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR