PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > i want to know what the following function is doing?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
i want to know what the following function is doing?

Réponse
 
LinkBack Outils de la discussion
Vieux 27/05/2008, 12h13   #1
amit129
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut i want to know what the following function is doing?

hi,

Please tell me what the below mentined code is doing? If i pass String
s as my name is "xyz. and " i am writing . what should be the output.

Thanks in advance

void parse(Block<String>& f, String s)
{
int inquote = 0;
int nf = 0;
int start = -1;
for(int i = 0; i <= length(s); i++){
if(i == length(s) || (isspace(s[i]) && !inquote) || (s[i] == '"' &&
inquote)){
if(start != -1){
nf++;
f.reserve(nf);
if(inquote && i != length(s))
f[nf-1] = s(start,i-start+1);
else
f[nf-1] = s(start,i-start);
start = -1;
inquote = 0;
}
}
else if(start == -1){
start = i;
inquote = (s[i] == '"');
}
}
f.size(nf);
}

Amit
  Réponse avec citation
Vieux 27/05/2008, 12h32   #2
Jens Thoms Toerring
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: i want to know what the following function is doing?

amit129 <rockiecool129@gmail.com> wrote:
> Please tell me what the below mentined code is doing? If i pass String
> s as my name is "xyz. and " i am writing . what should be the output.


> void parse(Block<String>& f, String s)


Why don't you put it into a simple program and just test what
it does? Moreover, you picked the wrong newsgroup, this one is
for C, not C++. The experts for C++ are on the other side of
the hallway in comp.lang.c++.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h46.


Édité par : vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08112 seconds with 10 queries