tags:

views:

22

answers:

1

Hi, with MVS2008, this line works fine:

_fsopen(file_name, "wb+", _SH_DENYRW);

Borland C++builderX from 2003 complains about the argument _SH_DENYRW. I changed to

_fsopen(file_name, "wb+", SH_DENYRW);

removing the underscore and Borland compiles well now. Is it good what I'm doing? I saw this modification somewhere on the web.

Thanks a lot..

A: 

Microsoft has been working bit by bit over time to make the names used in their C/C++ headers and libraries more standards compliant (though they aren't necessarily doing the same for names in the SDK headers and libraries - a subtle but important distinction). So you'll find that more and more of names that aren't in the standard are being prefixed with an underscore.

But MS often provides the ability to use the old, non-standards compliant names for backwards compatibility. You should be able to use the SH_DENYRW name in either MSVC or Borland unless you're telling the compiler to use strict standards compliance (for example, with the /Za option), since MSVC defines the following in share.h:

#if     !__STDC__
/* Non-ANSI names for compatibility */
#define SH_DENYRW _SH_DENYRW
#define SH_DENYWR _SH_DENYWR
#define SH_DENYRD _SH_DENYRD
#define SH_DENYNO _SH_DENYNO
#endif

#endif  /* _INC_SHARE */
Michael Burr
Thanks for this interesting information. SH_DENYRW works fine with Borland. I now understand that SH_DENYRW will work with MSVC also, though I haven't tried it (yet).
yCalleecharan