Cette petite application se compile bien, mais malheureusement, elle plante. Je vous met la source actuelle du fichier Input.C et du fichier Input.H
Input.C
Code: Select all /* input.c: voila, c'est un petit programme en C destin? ? placer une variable DOS que l'utilisateur aura compl?t?e. syntaxe: input variable o? variable est le nom de la variable a rentrer. */ #include <stdio.h> #include <stdlib.h> #include <string.h> /* Les Prototypes*/ #include "\BORLANDC\input.h" /*Bon passons maintenant ? la fonction principale*/ int main(int argc, char * argv[]) { int retour; char * var =""; if(argc!=2) { utilisation(); return 1; } printf("%s: ",argv[1]); gets(var); retour=variable(argv[1],var); return retour; } void utilisation() { printf("input.exe, une cr?ation du PCiste.Anonyme\n"); printf("?crit en C sous license GNU/GPL\n"); printf("La syntaxe est la suivante:\n"); printf("\tinput variable\n"); printf("o? variable est le nom de la variable ? attribuer\n"); printf("\nen cas de succ?s, input renvoie 0, sinon 1\n"); } int variable(char * var,char * setting) { int retour; char * appeldos=""; strcat(appeldos, "SET "); strcat(appeldos, var); strcat(appeldos, "="); strcat(appeldos, setting); strcat(appeldos, "\n\0"); retour=system(appeldos); return retour; } |
Code: Select all /* input.H Prototypes des fonctions du fichier Input.c */ void utilisation(); int variable(char * var,char * setting); |
(Je précise que j'utilise Borland C++ 3 sous Dos...)