Re: Question de C++

Top Page

Reply to this message
Author: Edgar Bonet
Date:  
To: guilde
Subject: Re: Question de C++
Salut !

Patrick DUPRÉ a écrit :
> warning: deprecated conversion from string constant to ‘char*’
> [...]
> extern int w_r_c (char *fmt, ...) ;
> [...]
> input_t = (char) w_r_c ("Type of signal: (P)ulse or (C)W (%c) ? ", input_t)


Une chaîne de caractères explicite, comme "Type of signal..." n'est pas
un tableau de char, mais un tableau de const char. Si ta fonction a
vraiment besoin de changer son paramètre fmt (ce qui semble peu probable),
il faut l'appeler en lui passant un tableau modifiable. Si ta fonction
ne fait que lire sa chaîne de format, alors tu la déclares comme ceci :

    extern int w_r_c(const char *fmt, ...);


À+,

Edgar.