I don't like flooding on forum so I'll ask a series of questions in one thread. 1. How safe is using exit(0); what are the advantages and disadvantages. 2. I have a file buffered in a stringstream. I access that stringstream more than once.. How can I reset the position from where it's being read using the >> operator? 3. About vectors, are they really safe when defining no size?

07-21-2005

Darryl

Not so sure what you mean by safe, but

1. Depends on your program, exit does standard cleanup and closes any open files. Also, you can use atexit() to have a function called in conjuction with using exit. That function can then do any "non-standard" cleanup.

2. seekg / seekp inherited from istream/ostream

3. again with the safe...hmmm, if you mean guranteed to clean up after themselves then yes they are safe. guaranteed to allocate memory when you properly add an element then yes (barring exceptional circumstance like being out of memory, but that's not vectors fault). If you mean using them in place of a c style array, then I would say they are not safe in the same way that arrays are not safe, since there is no bounds checking. However, when your program crashes cause you step out of bounds, the vector will still clean up after itself, where the array won't.