Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29418 ディスカッション

reading a string error

kooka
ビギナー
901件の閲覧回数

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 件の賞賛
3 返答(返信)
kooka
ビギナー
901件の閲覧回数

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

Steven_L_Intel1
従業員
901件の閲覧回数
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.
kooka
ビギナー
901件の閲覧回数
tanks for your help!, it works now
返信