RECHERCHER :
COMMUNAUTE MP
Identifiez vous ...
Devenir Membre
J'ai oublié mon MDP
DOMAINE MP
Bavardages
Langages Généraux
Langages Web
Langages DotNet
Autres langages
Dev. Jeux Video
Sécurité
Sys. Exploitation
Graphismes
Logiciels
Réseaux
Bases de données
Méthodologies
Emplois High-tech
Aide juridique
Articles juridiques
FORUM
Index des forums
Ajouter un sujet
Rechercher sujet
Contact Responsable
Devenir modérateur
CHAT MP IRC
Votre pseudo ...
Srv: irc.moteurprog.com
Chan: #MoteurProg
PARTICIPER
Plus de 3500 emplois.
Rechercher un job
Déposez votre CV
Emplois High-tech

Visiteur MP

 use string with sscanf and sprintf

Forum : LIBRAIRIE C++ - GTK
Sous Catégorie : GTK
Type du sujet : Sujet Normale
FAQ : FAQ LIBRAIRIE C++ - GTK

SUIVI DES SUJETS PAR MAIL

SUIVI PAR MAIL INACTIF

RESOLUTION DU SUJET SUJET NON RESOLU
BLOQUAGE DU SUJET SUJET ACTIF
APPARTENANCE A LA FAQ N'APPARTIENT PAS A LA FAQ


PAGE : [1]

POSTER UN NOUVEAU SUJET REPONDRE A CE SUJET

FORUM LIBRAIRIE C++ - GTK

PREMIERE PAGE

PAGE PRECEDENTE

Page précedente

Page suivante

PAGE SUIVANTE

DERNIERE PAGE
D2R5
Nouveau membre
Inscrit : 05/10/2005
Messages : 1
Message
#76867
Posté le 05/10/05 à 15:37
High,
I have a lot of trouble to choose a string class to produce Platform indepedant C/C++ code. Smiley
I thought with stl string class it will be right, but I still have many problems. The more important uestion IS : HOW to user stl string class with the standard sprintf and scanf ? I try to cast in (char*), to use string::c_str() to get a pointer, ... at the compilation everything is OK, but it crashed at the first sprintf or sscanf in the soft. :eveil: (All the string was set to a 128 length string before to be used).
Someone could help me to avoid this problem ? ;-) Smiley

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 

Publicité
Inscrit : X
Messages : X
Message
#Aucun

HAUT DE PAGE

  

patriarch24
Membre actif
Avatar de patriarch24
Inscrit : 08/05/2005
Messages : 100
Message
#91820
Posté le 23/03/06 à 14:56
Hi,
don't use sscanf and sprintf : use operator<< and operator>> instead. (use google to find a tutorial if needed).

Example :

string s; cout << "enter your string : "; cin >> s; cout << " s is : " << s << endl;

__________________________
Lisp : (have a (nice day))
C : have (a, nice, day);
C++/Java : have.aNice(day);
OCaml : have a nice day;;
shell : have a nice $day

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 

Alp
Superviseur :
- Système d'ex.
- Méthodologie.
- C & C++
Modérateur :
- Bavardages
Chef de projet(s) :
- My SDL Lib

Avatar de Alp
Inscrit : 24/06/2004
Messages : 2554
Message
#91900
Posté le 23/03/06 à 21:59
Moreover, there are stringstream classes to replace sprintf, so use std::string!
__________________________
Be C++
Mon Blog (C++, Intelligence Artificielle, Prolog)

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 
POSTER UN NOUVEAU SUJET REPONDRE A CE SUJET

PREMIERE PAGE

PAGE PRECEDENTE Page précédente

Page suivante

PAGE SUIVANTE DERNIERE PAGE

FORUM LIBRAIRIE C++ - GTK



    PAGE : [1]



.: Site Web développé par Julien Pichot et l'équipe MPWG avec www.evolvia-web.com :.