home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!bionet!raven.alaska.edu!acad2.alaska.edu!asmah
- From: asmah@acad2.alaska.edu
- Newsgroups: comp.sys.mac.programmer
- Subject: Inconsistantcy in Think C
- Message-ID: <1992Aug30.091804.1@acad2.alaska.edu>
- Date: 30 Aug 92 13:18:04 GMT
- Sender: news@raven.alaska.edu (USENET News System)
- Organization: University of Alaska
- Lines: 34
- Nntp-Posting-Host: acad2.alaska.edu
-
- I have run into some very strange problems working with Think C 5.0 lately and
- would like to know if anybody know's what is causing them. Here is one I can
- easily define.
-
- I have a sprintf() statement which doesn't work the first time through, but
- works during a second time. As far as I can tell, all the variables are
- identical during both passes. This is what it looks like.
-
- CharsHandle input;
- TEHandle TEFields[20];
-
- input = TEGetText(TEFields[0]);
- sprintf((**ARH.c_employee).last_name,"%.*s",(**TEFields[0]).teLength,(**input));
- return 1;
-
- The ARH variable is a large struct, suffice it to say that ).last_name is
- defined
- char last_name[20];
-
- When I go through this both times, with the debugger (**input) will show a
- short string, and teLength will correctly be the length of the string. However
- after the sprintf statement, last_name is still "". The second time through,
- everything can be exactly identical, but last_name will get the string.
- Something else I have noticed. It doesn't matter if it is the same piece of
- code or not, for some reason, the first sprintf statement anywhere, fails,
- after that, we're in good shape. Any idea's out there?
-
- / / / /
- /| /| o / o __ / /
- / |/ | / / _ / /_/ / /
- / | / / \ / \_ o o
- ________________________
- ____________________/
- \______________
-