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

reading a real number from a character variable

nandita
Beginner
485 Views
I'm using the following code:
character(10) text
real(4) num
...
read(text,*) num
It works fine when I assign a value to 'text' manually.
However, when Iassign a value to 'text' using GetDlgItemText and then try to read it into 'num',I get a this run-time error:
forrtl: severe(59): list-directed I/O syntax error, unit -5, file Internal List-Directed Read
What could the problem be?
nandita
0 Kudos
1 Reply
Steven_L_Intel1
Employee
485 Views
Two things. Using list-directed formatting for this purpose is dangerous, as it will accept things you may not, such as "Twinkie". Try it. Consider using G format instead.
Second, Win32 routines return null-terminated strings. Use INDEX to find the NULL and get the substring of the actiual text.

Message Edited by sblionel on 08-16-2004 03:15 PM

0 Kudos
Reply