Mercurial > hg > octave-lyh
comparison src/variables.cc @ 312:069ae2896cf7
[project @ 1994-01-19 21:40:41 by jwe]
author | jwe |
---|---|
date | Wed, 19 Jan 1994 21:40:54 +0000 |
parents | 3c23b8ea9099 |
children | fe6e790846f5 |
comparison
equal
deleted
inserted
replaced
311:c6e054496783 | 312:069ae2896cf7 |
---|---|
447 * Extract a keyword and its value from a file. Input should look | 447 * Extract a keyword and its value from a file. Input should look |
448 * something like: | 448 * something like: |
449 * | 449 * |
450 * #[ \t]*keyword[ \t]*:[ \t]*string-value\n | 450 * #[ \t]*keyword[ \t]*:[ \t]*string-value\n |
451 * | 451 * |
452 * Returns a pointer to a static variable which is only valid until | 452 * Returns a pointer to new storage. The caller is responsible for |
453 * the next time this function is called. | 453 * deleting it. |
454 */ | 454 */ |
455 char * | 455 char * |
456 extract_keyword (istream& is, char *keyword) | 456 extract_keyword (istream& is, char *keyword) |
457 { | 457 { |
458 ostrstream buf; | 458 ostrstream buf; |
459 | 459 |
460 static char *retval = (char *) NULL; | 460 char *retval = (char *) NULL; |
461 | |
462 delete [] retval; | |
463 retval = (char *) NULL; | |
464 | 461 |
465 char c; | 462 char c; |
466 while (is.get (c)) | 463 while (is.get (c)) |
467 { | 464 { |
468 if (c == '#') | 465 if (c == '#') |