I did some research ahead of time, and want to confirm it, as well as hopefully make my program work.
Okay, so I am working with Borland C++ 5.6 (don't know if it is C++ Builder 6.0 or CBuilderX), MSVC 8.0, and g++ 3.4. I want to check that my code is handled properly under each compiler using a #ifdef directive.
Here is what I found:
__BORLANDC__
_MSC_VER
__GNUC__ and __GNUG__ (C and C++)
Please confirm if you're able to. I am mostly only sketchy on __BORLANDC__ at the moment.
Now, the reason I would like to know this, is so that I can create a macro for each compiler's implementation of the FILE (typedef-ed from _iobuf in MSVC) structure in stdio.h. I need to skip over characters as needed inside of a file, but want to do so without a call to fread(), and certainly without an fseek(), ftell() combination. Thus, I am hoping to modify the location that a pointer member is directed at (if it exists across all implementations). I would like to know the name of the equivalent member of each structure, so that I can use it under three different names. In MSVC, the element I am looking to use is _ptr, and is a char *. I have found two char *'s that could be what I need in Borland (curm I believe, and buffer). I would suspect that one of these is what I need, but I can't remember if it worked when I had access to a Borland compiler earlier. I feel like I saw it work at some point. Now, under g++, things get a little crazy. The stdio.h that I am using falls under /usr/include/sys I believe (that or some other folder than sys and mingw). FILE is typedef-ed from __FILE, which is typedef-ed from possibly 2 different structures. I found what looked to be two different char *'s as well, but neither seemed to work (could have been that my above work wasn't done yet, and I had messed something up). For all I know, there isn't an equivalent inner pointer to where you are in a file (could be just a count up from the start of the file, and constant adjustment of the main pointer). Considering that I don't have anybody informed on the subject to ask, I just have to ask around here, and hope for a knowledgeable answer. =)
I should mention that I might need this by Thursday 10/26, since it is for an assignment. However, I already coded around the issue with fread(), where I just don't use the data that is transferred in. Regardless, I would like to know for future reference. Thank you very much! =)
Example code attached