Solved

word processing with console

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

679 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