- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wrote a program in CVF win32 Template, using dialog boxes, and i come across with some problems related to the translation of characters strings into real values.
Here is a code sample:
character(80) text
integer ioint
A0 real
integer(4) iret
.
case (WM_COMMAND)
if (LoWord(wParam) .EQ. IDC_EDIT_A0) then
iret = GetDlgItemText(dlg, IDC_EDIT_A0,text,len(text))
read(text,*,iostat = ioint) A0
.
.
.
endif
if i highlight all the numbers in the edit box and write the new value over the old, the translation do not proceed, the variable A0 keeps its old value.
What should i do? anybody knows?
ileao
Here is a code sample:
character(80) text
integer ioint
A0 real
integer(4) iret
.
case (WM_COMMAND)
if (LoWord(wParam) .EQ. IDC_EDIT_A0) then
iret = GetDlgItemText(dlg, IDC_EDIT_A0,text,len(text))
read(text,*,iostat = ioint) A0
.
.
.
endif
if i highlight all the numbers in the edit box and write the new value over the old, the translation do not proceed, the variable A0 keeps its old value.
What should i do? anybody knows?
ileao
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My guess is that the READ is failing - possibly because of the NUL in the string which I think will be returned by GetDlgItemText. What is the value of ioint after the READ? What is the contents of variable TEXT before the READ?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Before typing in the editing box the values were
before
Co = 6.2, ioint = 0 and text=' '
EDIT BOX = 20 [entered]
read(text,*,iostat = ioint) Co
after
text = '20 '
ioint = 59
Co = 6.2 [Unchanged]
I really dont know why!!!!!!! Read produced no effect.
ileao
before
Co = 6.2, ioint = 0 and text=' '
EDIT BOX = 20 [entered]
read(text,*,iostat = ioint) Co
after
text = '20 '
ioint = 59
Co = 6.2 [Unchanged]
I really dont know why!!!!!!! Read produced no effect.
ileao
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Error 59 is "List-directed I/O Syntax Error", which is what I expected. The READ is failing and thus doesn't change the variable.
I'll bet that after the 20 is a NUL. You need to adjust the length of TEXT to eliminate the NUL. One way is this:
then do the read.
Steve
I'll bet that after the 20 is a NUL. You need to adjust the length of TEXT to eliminate the NUL. One way is this:
i = index (text,char(0)) - 1 text = text(1:i)
then do the read.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve.
I dont if it's becouse i'm using the dfwina module, but the INDEX command seems to fail.
C:TEMPCVF - USER MADE Examplesgenesiswin32DATA.f90(318) : Error: This name has not been declared as an array or a function. [INDEX]
i = INDEX (co_text,char(0)) - 1
I dont if it's becouse i'm using the dfwina module, but the INDEX command seems to fail.
C:TEMPCVF - USER MADE Examplesgenesiswin32DATA.f90(318) : Error: This name has not been declared as an array or a function. [INDEX]
i = INDEX (co_text,char(0)) - 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
INDEX is an intrinsic, and I don't know of anything in DFWINA that would pose a conflict. Perhaps you have INDEX declared explicitly elsewhere?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve
Thank you very very much. It runs softly...!! You were right.
May be you could help me in another problem. Ill post right now.
ileao.
Thank you very very much. It runs softly...!! You were right.
May be you could help me in another problem. Ill post right now.
ileao.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page