Error code in Compaq Visual Fortran 6.5

Error code in Compaq Visual Fortran 6.5

Dear Sir or Madame,

I am trying to learn Compaq Visual Fortran from a book I
bought recently. There is an example with the line below:

hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, Null, OPEN_EXISTING, 0, NULL)

At this line an error occurs during the compilation of the code. Specifically, the following error appears in the Output window:

Error: The type of the actual argument differs from the type of the dummy argument. [0]

Could you please give some advice to correct this problem?

Thanks in advance.

e-mail address: dkatsap@tee.gr

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Jugoslav Dujic's picture

Declarations of Win32 API functions changed through CVF versions. I think those used in Norman Lawrence's book correspond to 6.6. As I recall, proper use for CreateFile was:

hFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL_SECURITY_ATTRIBUTES, OPEN_EXISTING, 0, NULL)

CVF 6.6 brought ALLOW_NULL attribute, which would allow user to use NULL or 0 instead of NULL_SOMETHING.

In any case, I'd recommend that when using Win32 APIs always do a "Find in Files" for symbol you want to use in C:...Microsoft Visual StudioDF98Include and take a look at INTERFACE block.

Also, consider upgrading to 6.6.

Jugoslav

Jugoslav www.xeffort.com

Login to leave a comment.