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

Serial Number not integer*4

davidgraham
Beginner
620 Views
I am using GetVolumeInformation to get the serial number.
I am expecting an integet*4 value to be returned.
Thisis what I get on my computer, but on another computer I get 49,684,256,597,454
Iexpect integer*4 to be in the range -2,147,483,648 to 2,147,483,647.
What is going on?
David
0 Kudos
4 Replies
Steven_L_Intel1
Employee
620 Views
You must have an INTEGER*8 variable in there somewhere or else you wouldn't even be able to display a value that large. How is it receiving the value? What does your code look like?
0 Kudos
davidgraham
Beginner
620 Views

Code:

 integer*4 Function VolSerialNo
! ------------------------------
! get volume serial number

  use dfwin

  integer*4 lpVolumeSerialNo
  character lpszDriveName*50,lpszSystemName*50,Volume*50
  logical*4 bRC

  lpszDriveName='c:'//char(0)
  bRC=GetVolumeInformation(lpszDriveName,Volume,50,LOC(lpVolumeSerialNo),NULL,NULL,lpszSystemName,32)
  VolSerialNo=iabs(lpVolumeSerialNo)

 end function


Here is my code to get the volume number, it is an integer*4

David

0 Kudos
Steven_L_Intel1
Employee
620 Views
Ok, how do you call this function and display the value? Is the function name declared as INTEGER*3 in the caller?
0 Kudos
davidgraham
Beginner
620 Views
I was being silly - I was doing other things between calling the function and displaying the result
0 Kudos
Reply