Changeset 802 in Sophya for trunk/SophyaLib/BaseTools/dvlist.cc
- Timestamp:
- Apr 3, 2000, 7:32:27 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/dvlist.cc
r754 r802 270 270 // ostream& operator << (ostream& s, DVList& dvl) 271 271 // sortie sur flot "s" (Appel a "Print(s)"). 272 // void Write(string const& fn)273 // Ecriture d'un fichier PPersist de nom "fn"274 // void Read(string const& fn)275 // Lecture d'un fichier PPersist de nom "fn"276 272 //-- 277 273 … … 350 346 { 351 347 char buf[512]; 348 string sfw; 352 349 353 350 int lc = dobj->Comment().length(); 354 if (lc > 511) lc = 511;355 351 if (lc > 0) { 356 352 sprintf(buf,"Comment: ( %6d ) ", lc); 357 s .PutLine(buf);358 s.Put Bytes(dobj->Comment().c_str(), lc);359 } 360 s .PutLine("----Variable-List---------------");353 sfw = buf; s.PutStr(sfw); 354 s.PutStr(dobj->Comment()); 355 } 356 sfw = "----Variable-List---------------"; s.PutStr(sfw); 361 357 DVList::ValList::const_iterator it; 362 358 for(it = dobj->Begin(); it != dobj->End(); it++) { … … 364 360 case 'I' : 365 361 sprintf(buf,"I %s %d", (*it).first.substr(0,64).c_str(), (*it).second.elval.mtv.iv ); 366 s .PutLine(buf);362 sfw = buf; s.PutStr(sfw); 367 363 break; 368 364 case 'D' : 369 365 sprintf(buf,"D %s %.20g", (*it).first.substr(0,64).c_str(), (*it).second.elval.mtv.dv ); 370 s .PutLine(buf);366 sfw = buf; s.PutStr(sfw); 371 367 break; 372 368 case 'S' : 373 369 sprintf(buf,"S %s %s", (*it).first.substr(0,64).c_str(), (*it).second.elval.mtv.strv ); 374 s .PutLine(buf);370 sfw = buf; s.PutStr(sfw); 375 371 break; 376 372 default : … … 380 376 if ((*it).second.elcomm.length() > 0) { 381 377 sprintf(buf,"# %s", (*it).second.elcomm.substr(0,256).c_str()); 382 s .PutLine(buf);383 } 384 } 385 386 s .PutLine("ZZZZZ--End-of-Varible-List------");378 sfw = buf; s.PutStr(sfw); 379 } 380 } 381 382 sfw = "ZZZZZ--End-of-Varible-List------"; s.PutStr(sfw); 387 383 } 388 384 … … 391 387 { 392 388 char buf[512]; 389 string sfr; 393 390 int_8 j,iv; 394 391 r_8 dv; … … 397 394 dobj->Clear(); 398 395 399 s.GetLine(buf, 511); // Pour lire les "------- " 400 if (buf[0] != '-') { // Il y a un champ commentaire a lire 401 buf[18] ='\0'; 402 int lc = atoi(buf+11); 403 if (lc > 511) { 404 cerr << "DVList::ReadSelf() Pb/Bug ?? CommentLength= " << lc << endl; 405 lc = 511; 406 } 407 s.GetBytes(buf, lc); 408 buf[lc] ='\0'; 409 dobj->Comment() = buf; 396 s.GetStr(sfr); // Pour lire les "------- " 397 if (sfr[0] != '-') { // Il y a un champ commentaire a lire 398 s.GetStr(sfr); 399 dobj->Comment() = sfr; 410 400 } 411 401 412 402 string key=""; 413 403 while(ok) { 414 s.GetLine(buf, 511); 404 s.GetStr(sfr); 405 strncpy(buf, sfr.c_str(), 512); 415 406 buf[511] = '\0'; 416 407 if (strncmp(buf,"ZZZZZ",5) == 0) { ok=false; break; }
Note:
See TracChangeset
for help on using the changeset viewer.