Hello everyone, I have searched for this high and low but could not find a solution.

To elaborate on the heading. I am trying to figure out a way to do this:

1. I have a text file with one line paths and file listing in it, for example:

E:\Movies\1408.avi
    E:\Movies\28.Days.Later[2002]
    E:\Movies\88Minutes-Gr8 Movie
    E:\Movies\Airplane.Part1![1980]

2. I would like to show one line at a time to the user on a command based program (windows cmd) and let them "EDIT" the 'pre-loaded' text and press enter (accept it in a variable as string).

3. Again as an example, I want the output to be something like this:

# Step 1 (Output)

The movie:
E:\Movies\28.Days.Later[2002] _  # <--  my cursor is the underscore.

#Step 2 (User edits the field)

The movie:
E:\Movies\28 Days Later _    # <-- after I finish editing the line.

# Step 3 (Press Enter)

The movie:

Thank you.

# done

I hope I have made it clear. I cannot find a way to pre-load the buffer with a string and display it to the user for editing and then accepting it.

Recommended Answers

All 2 Replies

How about using
http://docs.python.org/library/msvcrt.html

Keyboard reading and console printing functions.

Or maybe it is possible to use curses or readline routines?

Also if user has input things in keyboard they are in keyboard history and user can return to them by arrow keys and correct them.

@tonyvj

Thanks a lot for the information. I have some options to choose from now:
Still a long way before choosing the right way.

1. msvcrt: Only windows fx, I cannot port my app to Linux/mac

2. readline: Cannot use it in Windows without adding the package seperately.

3. curses: This seems useful.

I will post results after using all of them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.