Re: Newbie questions about variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andre,

You cannot strcpy into an array of 256 pointers.  Did you mean
  char theString[256];
?

theLine variable is being overwritten each time.

The memory occupied by theString variable is not erased from the computer's memory -- it is returned to the OS's free store.  If you are worried about the data stored in that variable, especially "post mortem" of the program's execution, you may want to take measures to overwrite the variable with garbage.

Assuming such a level of paranoia is warranted.

To allocate an object from the heap in C, use malloc.  And use free to relinquish it back to the heap.

To allocate an object from the free storein C++, use new. And use delete to relinquish it back to the free store.

HTH,
--Eljay



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux