Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7177 > unrolled thread
| Started by | Ruben Safir <ruben@mrbrklyn.com> |
|---|---|
| First post | 2011-06-26 21:43 +0000 |
| Last post | 2011-06-30 01:59 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.c++
C++ ios wrappers fpr ncurses Ruben Safir <ruben@mrbrklyn.com> - 2011-06-26 21:43 +0000
Re: C++ ios wrappers fpr ncurses Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-27 19:48 +0000
Re: C++ ios wrappers fpr ncurses Michael DOUBEZ <michael.doubez@free.fr> - 2011-06-30 01:59 -0700
| From | Ruben Safir <ruben@mrbrklyn.com> |
|---|---|
| Date | 2011-06-26 21:43 +0000 |
| Subject | C++ ios wrappers fpr ncurses |
| Message-ID | <iu896s$9ju$1@reader1.panix.com> |
The ncurses library has C based printing functions that look similar to this mvprintw(24, 0, "Charcter pressed is = %3d Hopefully it can be printed as '%c'", c, c); and I have a quiz, flashcard program that handles i/o to files with basic_iostreams in the classes that look like this class myclass (ostream os = cout). I figured I'd be able to hook in different streams for later development. But now I'm not sure how to go about it. Any tips or ideas? I have to create another stream class of somekind Ruben Ruben
[toc] | [next] | [standalone]
| From | Jorgen Grahn <grahn+nntp@snipabacken.se> |
|---|---|
| Date | 2011-06-27 19:48 +0000 |
| Message-ID | <slrnj0hnkr.gtj.grahn+nntp@frailea.sa.invalid> |
| In reply to | #7177 |
On Sun, 2011-06-26, Ruben Safir wrote: > The ncurses library has C based printing functions that look similar to > this > > mvprintw(24, 0, "Charcter pressed is = %3d Hopefully it can be printed as > '%c'", c, c); > > > and I have a quiz, flashcard program that handles i/o to files with > basic_iostreams in the classes that look like this > > class myclass (ostream os = cout). > > I figured I'd be able to hook in different streams for later > development. But now I'm not sure how to go about it. Any tips or ideas? > > I have to create another stream class of somekind Not really. (a) You don't have to use iostreams and (b) even if you do (and provide ostream << C for all your classes) you can output to an ostrstream and feed /that/ one to curses. /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o .
[toc] | [prev] | [next] | [standalone]
| From | Michael DOUBEZ <michael.doubez@free.fr> |
|---|---|
| Date | 2011-06-30 01:59 -0700 |
| Message-ID | <e30db7db-0653-471f-939c-b641035d25d9@y13g2000prb.googlegroups.com> |
| In reply to | #7177 |
On Jun 26, 11:43 pm, Ruben Safir <ru...@mrbrklyn.com> wrote: > The ncurses library has C based printing functions that look similar to > this > > mvprintw(24, 0, "Charcter pressed is = %3d Hopefully it can be printed as > '%c'", c, c); > > and I have a quiz, flashcard program that handles i/o to files with > basic_iostreams in the classes that look like this > > class myclass (ostream os = cout). > > I figured I'd be able to hook in different streams for later > development. But now I'm not sure how to go about it. Any tips or ideas? > > I have to create another stream class of somekind Well, you could create a steambuf outputing with ncurses's addch() and even create modifier for the flags but I don't know if it is worth the effort. Except for learning purpose, streams and manipulators are a rather dark part of the STL. I have had the occasion of implementing simple custom streams and manipulators for my work, it is a quite rewarding experience. If you want to explore it, you can try "Standard C++ IOStreams and Locales". I have not (yet) read it but, as I understand it, it is a kind of reference on the subject. Otherwise, I found the pstream project on sourceforge a good model and other articles details specific techniques; in particular the following for manipulators: http://accu.org/index.php/journals/350 -- Michael
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web