home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / os2 / programm / 6417 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  2.9 KB

  1. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!wupost!sdd.hp.com!elroy.jpl.nasa.gov!ames!pacbell.com!pacbell!oracle!unrepliable!bounce
  2. Newsgroups: comp.os.os2.programmer
  3. From: kschrait@oracle.uucp (Kevin Schraith)
  4. Subject: C Set/2 Help.   Please?
  5. Message-ID: <1992Nov14.012824.28935@oracle.us.oracle.com>
  6. Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
  7. Nntp-Posting-Host: mailseq.us.oracle.com
  8. Organization: Oracle Corporation, Redwood Shores CA
  9. References: <1992Oct21.232703.2448@schbbs.mot.com> <1992Oct22.123157.13686@watson.ibm.com> <BwJwqt.6Bs@csfb1.fir.fbc.com>
  10. Date: Sat, 14 Nov 1992 01:28:24 GMT
  11. X-Disclaimer: This message was written by an unauthenticated user
  12.               at Oracle Corporation.  The opinions expressed are those
  13.               of the user and not necessarily those of Oracle.
  14. Lines: 38
  15.  
  16. This is a specific question pertaining to a problem I am having with IBM 
  17. C Set/2 on OS/2 2.0.  I am trying to speak with IBM technical support about it,
  18. but they are busy people, and maybe someone on this group has run into a 
  19. similar problem.
  20.  
  21. Now I'm not 100% sure that the problem here doesn't lie in my code, but I can 
  22. find nothing myself to explain it.  Here goes...
  23.  
  24. I've inherited some code which does a bunch of fopen's and fclose's.  Normally,
  25. these calls work fine.  There is one point in the code where it always hits an
  26. Access Violation.  Always when trying to open the same exact file.  So, I fired
  27. up IPMD and stepped through it and found the problem spot.  Two different files
  28. are being open one after the other, the first succeeds and the second fails.  
  29. This failure is not the cause of the access violations; the FILE structure 
  30. which the pointer returned by fopen points to is invalid for the second file.
  31. Specifically, the count and tempStore fields, which are zero before the fopen
  32. call, and remain zero in the successful fopen call, are set to seemingly
  33. pointless values.  The actual access violation occurs when I execute a loop 
  34. that basically does a getc until an EOF.  Each getc call returns 0 (zero) and 
  35. decreases the FILE structure's count field by 1.  Assumably, the Access 
  36. Violation hits when the count gets to zero.  The unusual thing is the seemingly
  37. random values for count and tempStore are always the same.  
  38.  
  39. Does anyone out there have any idea what may cause this?  When I tried changing
  40. the order I fopen'ed the files, I found that the second fopen was the one that
  41. failed, regardless of the file I attempt to open.  I don't seem to be hitting
  42. a limit on file handles, as adding an extra 6 fopen's which I never fclose to 
  43. the beginning of the program doesn't change how or where the corruption occurs.
  44.  
  45. If possible, please respond by email, as I don't follow this group.
  46.  
  47. Thanks immensely in advance!!
  48.  
  49. Kevin
  50.  
  51. ---------------------------------------------------------
  52. Kevin Schraith, Desktop Products       Oracle Corporation
  53. kevins@netcom.com                          (415) 506-3268
  54.