home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14742 < prev    next >
Encoding:
Internet Message Format  |  1992-08-30  |  1.8 KB

  1. 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
  2. From: asmah@acad2.alaska.edu
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Inconsistantcy in Think C
  5. Message-ID: <1992Aug30.091804.1@acad2.alaska.edu>
  6. Date: 30 Aug 92 13:18:04 GMT
  7. Sender: news@raven.alaska.edu (USENET News System)
  8. Organization: University of Alaska
  9. Lines: 34
  10. Nntp-Posting-Host: acad2.alaska.edu
  11.  
  12. I have run into some very strange problems working with Think C 5.0 lately and 
  13. would like to know if anybody know's what is causing them.  Here is one I can 
  14. easily define.
  15.  
  16. I have a sprintf() statement which doesn't work the first time through, but
  17. works during a second time.  As far as I can tell, all the variables are
  18. identical during both passes.  This is what it looks like.
  19.  
  20. CharsHandle  input;
  21. TEHandle TEFields[20];
  22.  
  23. input = TEGetText(TEFields[0]);
  24. sprintf((**ARH.c_employee).last_name,"%.*s",(**TEFields[0]).teLength,(**input));
  25. return 1;
  26.  
  27. The ARH variable is a large struct, suffice it to say that  ).last_name is
  28. defined 
  29. char last_name[20];
  30.  
  31. When I go through this both times, with the debugger (**input) will show a
  32. short string, and teLength will correctly be the length of the string.  However
  33. after the sprintf statement, last_name is still "".  The second time through,
  34. everything can be exactly identical, but last_name will get the string. 
  35. Something else I have noticed.  It doesn't matter if it is the same piece of
  36. code or not, for some reason, the first sprintf statement anywhere, fails,
  37. after that, we're in good shape.  Any idea's out there?
  38.  
  39.    /  /                      /  /
  40.   /| /|    o   /    o  __   /  /
  41.  / |/ |   /   / _  /  /_/  /  /
  42. /     |  /   / \  /   \_  o  o
  43.   ________________________
  44.      ____________________/
  45.      \______________
  46.