Solved

word processing with console

Posted on 2004-03-23
3
217 Views
Last Modified: 2010-04-02
I need a function or something that works like word processing, you should be able to write an email in a console window, with a body and a subject and a from. And i want the body and the subject and from as strings. How is that possible?
0
Comment
Question by:illion
3 Comments
 
LVL 2

Expert Comment

by:guntherothk
ID: 10663368
I haven't tested it, but I believe the console window emulates an ANSI terminal. You can move the cursor around with control codes, insert and delete characters. Depending on the emulation you may be able to get the number of rows and columns of the current window as a string by sending a control code.

You'd define a representation of the document in (for instance) an array of strings in your program. You would use a package like the UNIX Curses package to update the screen when you modified your representation.

Writing the code would be quite time consuming (that is, worth more than 250 points). I can't imagine it would be worth the effort. Why do you want to edit in a console window anyway? It'd be way easier to build a simple dialog app and do your editing an a couple of text windows.
0
 

Author Comment

by:illion
ID: 10663407
Hmm, you are right but i still have to do it in the console window, i guess ill have to use iostream then and just use cin >>. But id hope there would be a better way to write the message body, cause its enoying if you want to change what you just wrote two lines away, but well perhaps thats the only way..
0
 
LVL 4

Accepted Solution

by:
bdunz19 earned 250 total points
ID: 10664632
Hi, I'd try using stdio.h rather than iostream and use the gets() function for inputing your lines (that will allow you to accept a whole line of strings rather than ending at each whitespace).

Do you want to be able to go back and edit things like specific lines? If you do you could do something like print out the current body and what it looks like but just have numbers down the side before each line begins. Then the user can enter a command like "/EDIT <line number>" which to edit line 2, would look like: /EDIT 2. Then I'd use keybd_event() to fill the console prompt buffer with the text from line 2.

I would think that would be the easiest way to do what you're looking for. But if it's not exactly what you were thinking then let me know with more discriptions of what you are wanting to do.

Hope that helps,
Brandon
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question