I am in the process of porting some code from an AIX 4.3.3 box (F50 - 32 bit machine) running C 5.0.1 onto an AIX 5.2 box (p630 - 64 bit machine) running C 5.0.2.
For some reason the code fails on an fgets call in the conditional statement of a while loop, but ONLY when a certain function is called within the loop.
Here's how it's set up:
I'm resisting posting the actual code here because it involves a lot of subroutines and data structures, which makes it quite lengthy. I know (from debugging statements I've added) that the program returns from the function call and the file status is still open. (The function does open another FILE pointer and closes it, but I checked the address of the pointer and it's different.)
Can anyone offer any help, or is this example too generalized?
For some reason the code fails on an fgets call in the conditional statement of a while loop, but ONLY when a certain function is called within the loop.
Here's how it's set up:
Code:
#define MAX_INBUF 1024
while (fgets(inbuf, MAX_INBUF, templateFile) != NULL) {
if a certain piece of text is contained within "inbuf"
call a function
the function returns okay (I've tested that)
but the next time "fgets" is called, it fails.
}
I'm resisting posting the actual code here because it involves a lot of subroutines and data structures, which makes it quite lengthy. I know (from debugging statements I've added) that the program returns from the function call and the file status is still open. (The function does open another FILE pointer and closes it, but I checked the address of the pointer and it's different.)
Can anyone offer any help, or is this example too generalized?