Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: How Does 'C' Store Strings ? Message-ID: <1263@virtech.UUCP> Date: 12 Oct 89 01:40:32 GMT References: <2141@avsd.UUCP> Organization: Virtual Technologies Inc Lines: 40 In article <2141@avsd.UUCP>, childers@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 | +-----------------------------------------------------------------------+