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

reading a string error

kooka
Beginner
587 Views

I am retriving values fron edit boxes to a real*4 variable. My program is so freak, I am working in a program thath uses quikwin and win32. When i retrieve them from a dialog box thath i display with quickwin routines there is no problem, but when i do it from a win32 dialog box, there is a problem in reading thath data, i paste my code in both quikwin and win32:

QUICKWIN: !works perfectly

real*4 gamma

character*20 str

bret = DLGGET(dlg, IDC_GAMMA, str)

READ(STR,*) GAMMA

WIN32 !DOESN'T WORKS

real*4 apsl

character*20 str

IRET=GETDLGITEMTEXT(HDLG,IDC_apsl,str,20)

READ(STR,*) apsl

I think there is a problem with the blanks in the STR variable, but im not sure

I WILL REGRET YOUR HELP

0 Kudos
3 Replies
kooka
Beginner
587 Views

in effect there is a problem with blanks because when i input less than 20 characters there's an error, when i input 20 or more there is not an error, but that problem is not present when i use quickwin routines. But i must use win 32 in this part of the program

0 Kudos
Steven_L_Intel1
Employee
587 Views
The Win32 version returns a string that is NUL-terminated, as in C. Fortran I/O doesn't like that. You'll need to use INDEX to find the position of the NUL (CHAR(0)) and read from the substring that is the actual text.
0 Kudos
kooka
Beginner
587 Views
tanks for your help!, it works now
0 Kudos
Reply