Solved

word processing with console

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now