Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old January 4th, 2007, 07:55 PM
Klapet
Guest
 
Posts: n/a
Default Events in C++ and work with IDE cdrom

Hi, I'm quite new in C++ programing and I want to ask, if I can handle
events in simple console-like program. For example I need one loop to
repeat until some key is pressed. Is it possible to make?

And then I would like to ask, if it is possible to read data from cdrom
over IDE. My intention is, to make a program for PSP (PlayStation
Portable), which could read data from cdrom connected to PSP (don't
know exactly how yet, but frirst of all I need to know, if the program
can be even written). So it would be some kind of file browser. There
is a program called usbhostfs and with this you can acces your HDD in
PC from PSP and do whatever you want with the data from PSP. But the
usbhostfs must be running on the PC, so the PSP's usbhost could somehow
connect to PC usbhostfs (something like connetcting client to server).
So my question is, if it is possible to read data from cdrom without
anything like "usbhostfs server"?

  #2  
Old January 4th, 2007, 08:35 PM
mlimber
Guest
 
Posts: n/a
Default Re: Events in C++ and work with IDE cdrom

Klapet wrote:
Quote:
Hi, I'm quite new in C++ programing and I want to ask, if I can handle
events in simple console-like program. For example I need one loop to
repeat until some key is pressed. Is it possible to make?
bool done = false;
char ch;
print_menu();
while( !done && (cin >ch) )
{
switch( ch )
{
case '1': /* Do menu option 1 */ break;
case '2': /* Do menu option 2 */ break;
case '3': /* Do menu option 3 */ break;
case 'Q': done = true; break;
}
print_menu();
}

If you mean without pressing enter, there's no way to do it without
using platform-dependent extensions:

http://www.parashift.com/c++-faq-lit...html#faq-15.17
Quote:
And then I would like to ask, if it is possible to read data from cdrom
over IDE. My intention is, to make a program for PSP (PlayStation
Portable), which could read data from cdrom connected to PSP (don't
know exactly how yet, but frirst of all I need to know, if the program
can be even written). So it would be some kind of file browser. There
is a program called usbhostfs and with this you can acces your HDD in
PC from PSP and do whatever you want with the data from PSP. But the
usbhostfs must be running on the PC, so the PSP's usbhost could somehow
connect to PC usbhostfs (something like connetcting client to server).
So my question is, if it is possible to read data from cdrom without
anything like "usbhostfs server"?
This is an OS-specific question. If you can mount something so you can
open it like a normal file, then sure. Otherwise, you can probably
still do it (there's not much that *can't* be done somehow in C++), but
you're beyond the bounds of standard C++ and thus this newsgroup. See
this FAQ for what is on-topic here and for some other newsgroups you
might consider:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Cheers! --M

  #3  
Old January 6th, 2007, 11:55 AM
Klapet
Guest
 
Posts: n/a
Default Re: Events in C++ and work with IDE cdrom

Thanks for the loop solution, but it's not working exactly the way I
would like to. Altough it gave me some ideas how to do that. But I'm
still unsuccessful.

I want to control winamp from command line, but the problem is, when I
start the playback, I need to print the current time on screen, but
when you press some key, it should stop (both the playback and the
counter). And there's the problem. When it is printing on screen, I
can't do anything (because of the running loop) and when I use your
solution, it's not counting.

So can you help me with this? Thanks in advance.

mlimber napsal:
Quote:
Klapet wrote:
Quote:
Hi, I'm quite new in C++ programing and I want to ask, if I can handle
events in simple console-like program. For example I need one loop to
repeat until some key is pressed. Is it possible to make?
>
bool done = false;
char ch;
print_menu();
while( !done && (cin >ch) )
{
switch( ch )
{
case '1': /* Do menu option 1 */ break;
case '2': /* Do menu option 2 */ break;
case '3': /* Do menu option 3 */ break;
case 'Q': done = true; break;
}
print_menu();
}
>
If you mean without pressing enter, there's no way to do it without
using platform-dependent extensions:
>
http://www.parashift.com/c++-faq-lit...html#faq-15.17
>
Quote:
And then I would like to ask, if it is possible to read data from cdrom
over IDE. My intention is, to make a program for PSP (PlayStation
Portable), which could read data from cdrom connected to PSP (don't
know exactly how yet, but frirst of all I need to know, if the program
can be even written). So it would be some kind of file browser. There
is a program called usbhostfs and with this you can acces your HDD in
PC from PSP and do whatever you want with the data from PSP. But the
usbhostfs must be running on the PC, so the PSP's usbhost could somehow
connect to PC usbhostfs (something like connetcting client to server).
So my question is, if it is possible to read data from cdrom without
anything like "usbhostfs server"?
>
This is an OS-specific question. If you can mount something so you can
open it like a normal file, then sure. Otherwise, you can probably
still do it (there's not much that *can't* be done somehow in C++), but
you're beyond the bounds of standard C++ and thus this newsgroup. See
this FAQ for what is on-topic here and for some other newsgroups you
might consider:
>
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
>
Cheers! --M
  #4  
Old January 8th, 2007, 02:35 PM
mlimber
Guest
 
Posts: n/a
Default Re: Events in C++ and work with IDE cdrom

Klapet wrote:
Quote:
mlimber napsal:
Quote:
Klapet wrote:
Quote:
Hi, I'm quite new in C++ programing and I want to ask, if I can handle
events in simple console-like program. For example I need one loop to
repeat until some key is pressed. Is it possible to make?
bool done = false;
char ch;
print_menu();
while( !done && (cin >ch) )
{
switch( ch )
{
case '1': /* Do menu option 1 */ break;
case '2': /* Do menu option 2 */ break;
case '3': /* Do menu option 3 */ break;
case 'Q': done = true; break;
}
print_menu();
}

If you mean without pressing enter, there's no way to do it without
using platform-dependent extensions:

http://www.parashift.com/c++-faq-lit...html#faq-15.17
>
Thanks for the loop solution, but it's not working exactly the way I
would like to. Altough it gave me some ideas how to do that. But I'm
still unsuccessful.
>
I want to control winamp from command line, but the problem is, when I
start the playback, I need to print the current time on screen, but
when you press some key, it should stop (both the playback and the
counter). And there's the problem. When it is printing on screen, I
can't do anything (because of the running loop) and when I use your
solution, it's not counting.
>
So can you help me with this? Thanks in advance.
At the risk of redundancy:

"If you mean [receiving input] without pressing enter, there's no way
to do it without
using platform-dependent extensions:

http://www.parashift.com/c++-faq-lit...html#faq-15.17 "

Consequently, you'll need to ask in a group for your OS.

Cheers! --M

PS, Please don't top-post here. It's considered rude (cf.
http://parashift.com/c++-faq-lite/ho....html#faq-5.4).

 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles