Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28442 Discussions

Error code in Compaq Visual Fortran 6.5

dkatsap
Beginner
471 Views
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
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
471 Views
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
0 Kudos
Reply