|
|||||||||||
|
safe strcpy()?
From: Ed Carp <erc(at)pobox.com>
Date: Tue Jan 28 2003 - 01:56:13 EST
This lef me to go back to my C textbooks (which I hadn't liiked in almost 20 years!), and start looking for a way to figure out how to determine how much space was allocated to a string. I was rather surprised to find that I couldn't find such an animal! Am I missing something here? Consider the simple case of:
my_strcpy (char *to, char *from)
The problem arises if the memory allocation for from exceeds that for to. Sizeof doesn't work - is there any way to programatically determine the memory allocation for "to"? I'm not interested in manual manipulation of code, or suggestions on changing coding style - there should be a way in the language to determine the size of an object at runtime. Any clues here? Thanks, guys! Received on Tue Jan 28 02:40:58 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:45 EDT |
||||||||||
|
|||||||||||