Highlighted
Absent Member.
Absent Member.
1340 views

Console::ReadLine

Jump to solution

[Migrated content. Thread originally posted on 17 April 2012]

I define a string variable,
01 name         string.
Then, how can I assign it the user input via the Console class' ReadLine method?

invoke type Console::ReadLine(pName)
set pName to Console::Readline()

Neither goes by without compiling errors, despite ReadLine's definition. I must admit lack of knowledge on oo, but the other methods from Console seem to work just fine.

On this regard, is there anywhere I can read descriptions for the different default classes and their methods?
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Console::ReadLine

Jump to solution
The portable solution between .Net and JVM is to use accept/display or exhibit e.g.:

    01 a string.
    accept a
    exhibit named a.

View solution in original post

0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: Console::ReadLine

Jump to solution
This should work:

set name to type Console::ReadLine()

Passing the string to ReadLine will not work as the ReadLine method doesn't take a parameter (Documentation here: http://msdn.microsoft.com/en-us/library/system.console.aspx) and your other line wouldn't work because of the invoke. I believe that invoke is only needed when you are calling a void method.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Console::ReadLine

Jump to solution
The portable solution between .Net and JVM is to use accept/display or exhibit e.g.:

    01 a string.
    accept a
    exhibit named a.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Console::ReadLine

Jump to solution
Thanks!
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.