Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 21st, 2004, 9:42 PM   #1
holycrap
Newbie
 
Join Date: Nov 2004
Posts: 5
Rep Power: 0 holycrap is on a distinguished road
I have a graphics plotting program that doesn't have much of an 'on-the-fly' input output interface. the user either has to write a script file or has to use the limited options in the dialog boxes.
softwares like AutoCAD and the FEA software like ABAQUS, NASTRAN etc.. have a text box at the bottom of their screen thru which users can enter commands and the program outputs stuff onto an output textbox.
can someone tell me or point me to some place that tells me how to best implement this sort of thing ?

the I/O routines in my program use the iostream classes- basically reads commands from some script file and prints out stuff to some output file or cout. e.g. a typical routine would be:
void readMesh(istream*, ostream*, other arguments) {}

now, the GUI uses MFC and part of my confustion is how do i redirect all this program ouput that goes to the (ostream*) to go to a textbox in the GUI instead, without making major or atleast tedious mods to the existing code. and similarly, how do i redirect input from a textbox to go to an istream ?

is this even possible?? if not, i guess i will have to change the whole program structure, but even then i would like to know how it is implemented in the big commercial softwares like autocad so i get it right atleast this time.

thanks
holycrap is offline   Reply With Quote
Old Nov 21st, 2004, 10:16 PM   #2
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
You can redirect input to an istream using the istringstream class, simply put it converts the input string generated in MFC into an inputstream.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Nov 24th, 2004, 1:58 AM   #3
holycrap
Newbie
 
Join Date: Nov 2004
Posts: 5
Rep Power: 0 holycrap is on a distinguished road
thanks, this is what i was looking for.
so, now i need to implement the whole textboxes and see how it all works out.

btw, do u know if there is a limit on the size of the string that an istringstream object can hold ? cos i wud expect my output textbox to have enuf text to keep scrolling on for many pages.
holycrap is offline   Reply With Quote
Old Nov 24th, 2004, 7:24 AM   #4
Eggbert
Professional Programmer
 
Eggbert's Avatar
 
Join Date: Nov 2004
Posts: 250
Rep Power: 4 Eggbert is on a distinguished road
>do u know if there is a limit on the size of the string that an istringstream object can hold ?
numeric_limits<streamsize>::max()
would be a good assumption. It's also a good (ei. safe) assumption to think that streamsize is a narrower type than string::size_type because the former is signed and the latter is unsigned. You would be better off splitting the string data into pages so that you don't reach these limits.
Eggbert is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:35 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC