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

  FORUM HardWare.fr
  Programmation
  C++

  [C++]Probleme avec EXECV(P) sous Windows

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[C++]Probleme avec EXECV(P) sous Windows

n°604522
botman
Cubeur
Posté le 07-01-2004 à 11:03:59  profilanswer
 

bonjour,
 
j'ai un petit probleme : j'essaie dans un code C++ d'integrer un outil de maillage qui se lance en ligne de commandes, avec un certain nombre d'arguments. J'utilise donc _execv ou _execvp fournies dans Process.h.
 
Le chemin vers l'executable du mailleur est dans le path de windows. Voici comment je definis les arguments et comment je lance le mailleur :
 
 
char *arguments[8];
 char buffer[30];
 arguments[0] = "C:\devel\bamg\Debug\bamg";
 arguments[1] = "-g";
 arguments[2] = GeometryFileName.GetBuffer();
 arguments[3] = "-o";
 arguments[4] = MeshFileName.GetBuffer();
 arguments[5] = "-thetaquad";
 sprintf(&(buffer[0]), "%f", angle);
 arguments[6] = &(buffer[0]);
 arguments[7] = "-2q";
 
 //Appel systeme
 i = _execv(arguments[0], arguments);  
 bidule = errno;
 
errno indique 22 comme code d'erreur , soit une erreur d'argument. or tous mes arguments sont censes etre bons , j'ai teste cette ligne de commande en dehors de ce contexte.
 
De plus lorsque je vire le chemin complet vers l'executable j'ai une erreur  mémoire qui se produit, alors qu'avec mon path, ca devrait etre bon.
 
Ou puis je avoir faitune erreur :??:
 
passke la, je vois pas :fou:

mood
Publicité
Posté le 07-01-2004 à 11:03:59  profilanswer
 

n°604525
chrisbk
-
Posté le 07-01-2004 à 11:05:20  profilanswer
 

"C:\devel\bamg\Debug\bamg"; << la pe ? :??:
 
"C:\\devel\\bamg\\Debug\\bamg"; :o


Message édité par chrisbk le 07-01-2004 à 11:05:39
n°604534
botman
Cubeur
Posté le 07-01-2004 à 11:12:11  profilanswer
 

pourquoi un double \ ?
 
bon je v essayer :)

n°604537
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 07-01-2004 à 11:13:51  profilanswer
 

BotMan a écrit :

pourquoi un double \ ?


\ c'est pour escaper les caractères :o
Quand tu fais printf("\n" ); tu crois qu'il t'affiche \n ou un retour chariot ? :o


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
n°604553
botman
Cubeur
Posté le 07-01-2004 à 11:19:53  profilanswer
 

ah oui cai vrai j'avais ooblié :o
 
mais ca plante, acces violation : 0xC0000005 , genial :/

n°604556
chrisbk
-
Posté le 07-01-2004 à 11:20:53  profilanswer
 

BotMan a écrit :

ah oui cai vrai j'avais ooblié :o
 
mais ca plante, acces violation : 0xC0000005 , genial :/


 
Ce qui mÄetonnes ce que tu specifie null part le nombre d'arguments . T sur qu'il faut pas un NULL a la fin de ton tableau d'arugements ?

n°604559
chrisbk
-
Posté le 07-01-2004 à 11:22:20  profilanswer
 

et si, gagné [:udok]
 

Citation :


The _execv, _execve, _execvp, and _execvpe calls are useful when the number of parameters to the new process is variable. Pointers to the parameters are passed as an array, argv. The parameter argv[0] is usually a pointer to cmdname. The parameters argv[1] through argv[n] point to the character strings forming the new parameter list. The parameter argv[n+1] must be a NULL pointer to mark the end of the parameter list.


Message édité par chrisbk le 07-01-2004 à 11:22:46
n°604560
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 07-01-2004 à 11:22:42  profilanswer
 

Ui, il faut un NULL.


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
n°604570
chrisbk
-
Posté le 07-01-2004 à 11:26:42  profilanswer
 

BOTMAN KESTUFOUS ?? SKOI DSE CODE DE MERDE :FOU: :FOU:

n°604574
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 07-01-2004 à 11:28:38  profilanswer
 

(Faut définir arguments comme un char[9], du coup, pour rajouter le NULL :o J'adore C/C++ [:icon7])


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
mood
Publicité
Posté le 07-01-2004 à 11:28:38  profilanswer
 

n°604579
chrisbk
-
Posté le 07-01-2004 à 11:29:34  profilanswer
 

Taiche a écrit :

(Faut définir arguments comme un char[9], du coup, pour rajouter le NULL :o J'adore C/C++ [:icon7])


 
t'as maté mon paté de cette nuit ? [:itm]

n°604585
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 07-01-2004 à 11:31:47  profilanswer
 

chrisbk a écrit :


t'as maté mon paté de cette nuit ? [:itm]


:??: Oussa ?


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
n°604586
chrisbk
-
Posté le 07-01-2004 à 11:32:26  profilanswer
 
n°604589
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 07-01-2004 à 11:34:31  profilanswer
 


Ah ouais, j'avais bien rigolé [:ddr555]
Mais bon, on va pas troller ici pour pas pourrir le topic :o


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
n°604592
chrisbk
-
Posté le 07-01-2004 à 11:36:22  profilanswer
 

Taiche a écrit :


Ah ouais, j'avais bien rigolé [:ddr555]
Mais bon, on va pas troller ici pour pas pourrir le topic :o


et alors, ta fine explication ? :D
pis il est resolu stopic, c juste botman qui fait l'ane et qui lit pas la doc [:icon11] :D


Message édité par chrisbk le 07-01-2004 à 11:36:55
n°604599
Taiche
(╯°□°)╯︵ ┻━┻
Posté le 07-01-2004 à 11:40:43  profilanswer
 

chrisbk a écrit :


et alors, ta fine explication ? :D


Ah ba j'en sais rien, moi :o J'connais pas les méandres de C++, j'ai d'jà du mal avec les pointeurs et les références... :D


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
n°604605
chrisbk
-
Posté le 07-01-2004 à 11:42:37  profilanswer
 

Taiche a écrit :


Ah ba j'en sais rien, moi :o J'connais pas les méandres de C++, j'ai d'jà du mal avec les pointeurs et les références... :D


 
pour la petite histoire la reponse a la question bonus c'est :
 
test( (void*)(tB*) t);
 
et tout ceci vient du fait que :
(tA*)t != (tB *)t (en terme d'adresse)
la grosse feinte du pere lafeinte quoi

n°604654
botman
Cubeur
Posté le 07-01-2004 à 12:17:54  profilanswer
 

chrisbk a écrit :

BOTMAN KESTUFOUS ?? SKOI DSE CODE DE MERDE :FOU: :FOU:

finalement j'ai utilisé system au lieu d'execvp ca amrchebcp mieux :D :sol:

n°604655
chrisbk
-
Posté le 07-01-2004 à 12:20:09  profilanswer
 

:sweat:

n°604657
botman
Cubeur
Posté le 07-01-2004 à 12:22:06  profilanswer
 

:??:

n°604660
chrisbk
-
Posté le 07-01-2004 à 12:23:59  profilanswer
 

on se decarcasse pour toi et toi tu nous trompes avec cette petite fonction a la con, bravo [:sisicaivrai]

n°604799
botman
Cubeur
Posté le 07-01-2004 à 15:06:49  profilanswer
 

:sol:

n°604802
chrisbk
-
Posté le 07-01-2004 à 15:09:25  profilanswer
 

creve tout nu :o

n°613321
chrisbk
-
Posté le 16-01-2004 à 11:26:46  profilanswer
 

kestu remontes ce topic toi :??:

mood
Publicité
Posté le   profilanswer
 


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

  [C++]Probleme avec EXECV(P) sous Windows

 

Sujets relatifs
valeure d'1 évenement windowsUrgent (devoir à rendre). Probleme avec le HTML
Petit problème avec expression régulière...Perdu sous Windows :)
probleme d'integration de script php !! need assistance ![HTML] Toujours Problème de .htaccess
Problème de tableauProbleme de parse de XML JasperReport
Probleme avec un echo[C++] problème étrange
Plus de sujets relatifs à : [C++]Probleme avec EXECV(P) sous Windows


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