How Does 'C' Store Strings ?
Conor P. Cahill
cpcahil at virtech.UUCP
Thu Oct 12 11:40:32 AEST 1989
In article <2141 at avsd.UUCP>, childers at avsd.UUCP (Richard Childers) writes:
> Basically, no matter how I look at the resulting executable - whether
> with my 'strings', or a quick-and-dirty 'od' - I can't find the ASCII
> characters corresponding to the strings I thought I had compiled into
> the executable.
How are you opening the input file? In MSC you must specify something
like O_BINARY in order to read a complete non-text file. The strings
are stored the same way in MSC as they are stored in UNIX executables -
non-compressed sequences of characters followed by a null byte.
Long ago I wrote a strings for dos which worked correctly under MSC 3.0.
I don't know where it is now.
> #define vers[CMDBUFSIZ] = "v1.00 891010 richard childers" ;
What is this supposed to do? First of all the only way to use it is to
have a global variable as follows:
char string_you_want vers;
which is totally unreadable. What were you attempting to do? There is
nothing that you can do through the preprocessor that you couldn't do
directly in the code.
> One of the possibilities I've considered includes the fact that, while I've
> defined this array, I've never referenced it, and thus the compiler might
> have decided to optomize it out of existence.
If this was true, all of the sccsid and rcsid strings would never
appear in the object files (which they do).
--
+-----------------------------------------------------------------------+
| Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 !
| Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 |
+-----------------------------------------------------------------------+
More information about the Comp.lang.c
mailing list