Solved

word processing with console

Posted on 2004-03-23
3
218 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

839 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