Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

word processing with console

Posted on 2004-03-23
3
Medium Priority
?
224 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 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.
Suggested Courses

916 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