home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++,gnu.g++
- Path: sparky!uunet!munnari.oz.au!newsroom.utas.edu.au!bruny.cc.utas.edu.au!u895217
- From: u895217@bruny.cc.utas.edu.au (Scott Marshall)
- Subject: Variable Declarations
- Message-ID: <u895217.716089910@bruny>
- Summary: Help!!
- Keywords: variables, constructors
- Sender: news@newsroom.utas.edu.au
- Organization: University of Tasmania, Australia.
- Date: Thu, 10 Sep 1992 01:51:50 GMT
- Lines: 25
-
- Hi.
- I need a little advice on using C++. When given the following code, would
- the variable being declared (and initialised) be re-initialised on every
- iteration?
-
- char buf[whatever];
- f.getline(buf, whatever);
- while (buf[0] != '#') {
- String s = buf;
- if (s.contains("int") ...
- else ...
- f.getline(buf, whatever); }
-
- If this is still ambiguous, I need to know whether, each time round the while
- loop, 's' will be modified to have the contents of 'buf', or whether only the
- initial read of 'buf' will give 's' its value.
- BTW. This is in GNU C++. I'm not sure if the String class is the same for
- other C++ compilers.
-
- Any help will save me some time, and will be greatly appreciated.
-
-
-
- Scott Marshall.
- (u895217@bruny.cc.utas.edu.au)
-