home *** CD-ROM | disk | FTP | other *** search
- 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
- Newsgroups: comp.os.os2.programmer
- From: kschrait@oracle.uucp (Kevin Schraith)
- Subject: C Set/2 Help. Please?
- Message-ID: <1992Nov14.012824.28935@oracle.us.oracle.com>
- Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
- Nntp-Posting-Host: mailseq.us.oracle.com
- Organization: Oracle Corporation, Redwood Shores CA
- References: <1992Oct21.232703.2448@schbbs.mot.com> <1992Oct22.123157.13686@watson.ibm.com> <BwJwqt.6Bs@csfb1.fir.fbc.com>
- Date: Sat, 14 Nov 1992 01:28:24 GMT
- X-Disclaimer: This message was written by an unauthenticated user
- at Oracle Corporation. The opinions expressed are those
- of the user and not necessarily those of Oracle.
- Lines: 38
-
- This is a specific question pertaining to a problem I am having with IBM
- C Set/2 on OS/2 2.0. I am trying to speak with IBM technical support about it,
- but they are busy people, and maybe someone on this group has run into a
- similar problem.
-
- Now I'm not 100% sure that the problem here doesn't lie in my code, but I can
- find nothing myself to explain it. Here goes...
-
- I've inherited some code which does a bunch of fopen's and fclose's. Normally,
- these calls work fine. There is one point in the code where it always hits an
- Access Violation. Always when trying to open the same exact file. So, I fired
- up IPMD and stepped through it and found the problem spot. Two different files
- are being open one after the other, the first succeeds and the second fails.
- This failure is not the cause of the access violations; the FILE structure
- which the pointer returned by fopen points to is invalid for the second file.
- Specifically, the count and tempStore fields, which are zero before the fopen
- call, and remain zero in the successful fopen call, are set to seemingly
- pointless values. The actual access violation occurs when I execute a loop
- that basically does a getc until an EOF. Each getc call returns 0 (zero) and
- decreases the FILE structure's count field by 1. Assumably, the Access
- Violation hits when the count gets to zero. The unusual thing is the seemingly
- random values for count and tempStore are always the same.
-
- Does anyone out there have any idea what may cause this? When I tried changing
- the order I fopen'ed the files, I found that the second fopen was the one that
- failed, regardless of the file I attempt to open. I don't seem to be hitting
- a limit on file handles, as adding an extra 6 fopen's which I never fclose to
- the beginning of the program doesn't change how or where the corruption occurs.
-
- If possible, please respond by email, as I don't follow this group.
-
- Thanks immensely in advance!!
-
- Kevin
-
- ---------------------------------------------------------
- Kevin Schraith, Desktop Products Oracle Corporation
- kevins@netcom.com (415) 506-3268
-