Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 help with beginning code
Index -> Programming, C++ -> C++ Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
btiffin




PostPosted: Sat Oct 25, 2008 2:04 pm   Post subject: Re: RE:help with beginning code

md @ Sat Oct 25, 2008 12:38 am wrote:

waiting for needless input at the end of your program is such a bad practice that anyone who recommends it should be shot. Or failing that banned from programming. Ever.

hear, all ye good people, hear what this brilliant and eloquent speaker has to say!
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Sat Oct 25, 2008 10:33 pm   Post subject: RE:help with beginning code

Would a frontal lobotomy be acceptable?
Rigby5




PostPosted: Mon Oct 27, 2008 12:11 am   Post subject: RE:help with beginning code

The getch() function is in curses.h, so it available to Linux programmers as well.
But there is also getchar() in C++.
The point is that you often need to have data on individual key presses, not just after the <return> key is entered.

And this problem of disappearing console windows can also come up when you run a batch script from the command line.
wtd




PostPosted: Mon Oct 27, 2008 1:39 am   Post subject: RE:help with beginning code

Care to provide evidence of well-written command-line applications that can close the terminal window they're being run in?
md




PostPosted: Mon Oct 27, 2008 4:30 pm   Post subject: Re: RE:help with beginning code

Rigby5 @ 2008-10-27, 12:11 am wrote:
The getch() function is in curses.h, so it available to Linux programmers as well.
But there is also getchar() in C++.
The point is that you often need to have data on individual key presses, not just after the <return> key is entered.

And this problem of disappearing console windows can also come up when you run a batch script from the command line.


curses.h is not a standard library, but part of (usually) the ncurses library. Likewise getchar() is part of cstdlib, again not standard C++. While knowing keystrokes can be helpful in some (limited) cases, it's actually quite easy to get single characters using std::cin.get(). However, knowing key presses is usually not needed and where it is you are usually better off using standard libraries to handle it for you (ncurses is actually the defacto standard).
btiffin




PostPosted: Mon Oct 27, 2008 4:48 pm   Post subject: Re: RE:help with beginning code

wtd @ Mon Oct 27, 2008 1:39 am wrote:
Care to provide evidence of well-written command-line applications that can close the terminal window they're being run in?
Rigby5 wrote:

...
And this problem of disappearing console windows can also come up when you run a batch script from the command line.

wtd; I'm not in Windows right now, so I can't test this; but I'm assuming Rigby5 has experienced windows batch files (be they WSHell, or vb or js or .bat or what have) that include
code:
cmd.exe /c
versus
code:
cmd.exe /k
Maybe?

Note; I'm ignoring the well-written part of your post. Not to bash MS or anything, but are there any well-written Windows command-line applications? Seeing as the Windows command console is not well-written (imho - it's junk and costs time and effort, further holding back humanity's quest for a productive computing experience).

Cheers
Rigby5




PostPosted: Tue Oct 28, 2008 12:35 am   Post subject: RE:help with beginning code

Unlike Linux, Windows does not really have a console.
With Linux you have stdin, stdout, and stderr as 0, 1, and 2.
But with windows, each application gets a consecutive number, so a batch run from the command line, gets 3, 4, and 5, etc.
Depending on whether you call, execute, etc., you can open and additional cmd line window or not.
It just is not at all the same as a Linux console, and you might as well not think of Windows as even having a cmd line really. It is just a text based window.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 22 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: