home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13455 < prev    next >
Encoding:
Text File  |  1992-09-09  |  1.1 KB  |  38 lines

  1. Newsgroups: comp.lang.c++,gnu.g++
  2. Path: sparky!uunet!munnari.oz.au!newsroom.utas.edu.au!bruny.cc.utas.edu.au!u895217
  3. From: u895217@bruny.cc.utas.edu.au (Scott Marshall)
  4. Subject: Variable Declarations
  5. Message-ID: <u895217.716089910@bruny>
  6. Summary: Help!!
  7. Keywords: variables, constructors
  8. Sender: news@newsroom.utas.edu.au
  9. Organization: University of Tasmania, Australia.
  10. Date: Thu, 10 Sep 1992 01:51:50 GMT
  11. Lines: 25
  12.  
  13. Hi.
  14. I need a little advice on using C++. When given the following code, would
  15. the variable being declared (and initialised) be re-initialised on every
  16. iteration?
  17.  
  18.     char buf[whatever];
  19.     f.getline(buf, whatever);
  20.     while (buf[0] != '#') {
  21.         String s = buf;
  22.         if (s.contains("int") ...
  23.         else ...
  24.         f.getline(buf, whatever); }
  25.  
  26. If this is still ambiguous, I need to know whether, each time round the while
  27. loop, 's' will be modified to have the contents of 'buf', or whether only the
  28. initial read of 'buf' will give 's' its value.
  29. BTW. This is in GNU C++. I'm not sure if the String class is the same for
  30. other C++ compilers.
  31.  
  32. Any help will save me some time, and will be greatly appreciated.
  33.  
  34.  
  35.  
  36. Scott Marshall.
  37. (u895217@bruny.cc.utas.edu.au)
  38.