Home > Archive > C > June 2006 > OT: Windows console programs (was Re: Function Pointers)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
OT: Windows console programs (was Re: Function Pointers)
|
|
| Kenneth Brody 2006-06-29, 6:56 pm |
| Frederick Gotham wrote:
>
> Richard Heathfield posted:
>
>
> Sorry, not sure what you mean.
He meant that your system() call caused the above error to appear on
his screen when he ran your program.
> I tend to put:
>
> system("PAUSE");
>
> at the end of my code snippets because a lot of people use Windows;
Perhaps, but that's irrelevent in clc.
> and on
> Windows, a console windows disappears once the program has finished
> execution.
Not for me, and I've been running Windows on some of my computers
since version 1.0 was in Alpha testing.
For example:
C:\temp>hello
Hello, world.
C:\temp>
Looks like my window is still there.
Even if running the program from within my IDE, I get a "press any
key to continue" prompt before the window closes.
> It's just for convenience so that my snippets are easy to compile
> straight-out-of-the-box.
I don't see how it helps to compile it. It may, on your system,
help you run it without the window disappearing. However, it only
hurts those not on Windows.
Why not simply add:
while ( getchar() != '\n' ) ;
Or:
printf("Press Enter to continue.\n");
fflush(stdout);
while ( getchar() != '\n' )
;
These will work on non-Windows platforms as well.
Of course, on most systems, the above code will simply annoy the user,
as they wonder "why do I need to press Enter to get this program to
exit?"
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap@gmail.com>
| |
| Richard Heathfield 2006-06-29, 6:56 pm |
| Kenneth Brody said:
<snip>
> Of course, on most systems, the above code will simply annoy the user,
> as they wonder "why do I need to press Enter to get this program to
> exit?"
Ctrl-Alt-Del to begin, Start to finish, and now Enter to exit. Got to love
Windows.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
| |
| Barry Schwarz 2006-06-29, 9:56 pm |
| On Thu, 29 Jun 2006 17:29:22 +0000, Richard Heathfield
<invalid@invalid.invalid> wrote:
>Kenneth Brody said:
>
><snip>
>
>
>Ctrl-Alt-Del to begin, Start to finish, and now Enter to exit. Got to love
>Windows.
Unix isn't much better. The rename command is mv; the block
read/write command is dd, and one edit command is vi.
Remove del for email
| |
| Andrew Poelstra 2006-06-30, 3:56 am |
| On 2006-06-30, Barry Schwarz <schwarzb@doezl.net> wrote:
> On Thu, 29 Jun 2006 17:29:22 +0000, Richard Heathfield
><invalid@invalid.invalid> wrote:
>
>
> Unix isn't much better. The rename command is mv; the block
> read/write command is dd, and one edit command is vi.
>
Those aren't counter-intuitive. Renaming a file is essentially giving it
a different address. A change-of-address is usually a MoVe. And if you
don't want to use a line editor, try the VIsual editor.
I can't justify dd, other than to say that it's a very powerful tool,
and can be used for more that "Block Reader/Writer" would encompass.
--
Andrew Poelstra <http://www.wpsoftware.net/blog>
To email me, use "apoelstra" at the above address.
"You people hate mathematics." -- James Harris
| |
| Ian Collins 2006-06-30, 3:56 am |
| Andrew Poelstra wrote:
> On 2006-06-30, Barry Schwarz <schwarzb@doezl.net> wrote:
>
>
>
> Those aren't counter-intuitive. Renaming a file is essentially giving it
> a different address. A change-of-address is usually a MoVe. And if you
> don't want to use a line editor, try the VIsual editor.
>
The commands are probably this verbose because there were more than 26,
so two characters had to be used :)
--
Ian Collins.
| |
| Richard Bos 2006-06-30, 3:56 am |
| Andrew Poelstra <apoelstra@localhost.localdomain> wrote:
> On 2006-06-30, Barry Schwarz <schwarzb@doezl.net> wrote:
>
> Those aren't counter-intuitive. Renaming a file is essentially giving it
> a different address.
No, it's giving it a different name. AFAIAA, the inode doesn't even
change.
> A change-of-address is usually a MoVe.
True, but irrelevant to renaming. If I remove the slice of pine saying
"Dunroamin" in a brush letter from my house, and put in its place a
faux-stone plaque saying "RLB MANSION" in faux-chiseled quadrata, I do
not need to pack up the plates.
> And if you don't want to use a line editor, try the VIsual editor.
I'd rather use a real editor, but that's another issue.
Richard
| |
| Kenneth Brody 2006-06-30, 6:56 pm |
| Richard Bos wrote:
>
> Andrew Poelstra <apoelstra@localhost.localdomain> wrote:
>
[...][color=darkred]
>
> No, it's giving it a different name. AFAIAA, the inode doesn't even
> change.
It does if you move it to a different filesystem.
>
> True, but irrelevant to renaming. If I remove the slice of pine saying
> "Dunroamin" in a brush letter from my house, and put in its place a
> faux-stone plaque saying "RLB MANSION" in faux-chiseled quadrata, I do
> not need to pack up the plates.
However, it's still a "move", and not a "rename" program. Yes, you
can move it to a new name in the same directory, which is the same
effect as a rename, but that's just coincidental.
>
> I'd rather use a real editor, but that's another issue.
I forget if it was here or elsewhere, but I saw someone point out
(related to the recent "6/6/6" date) that "vi vi vi" is "the editor
of the beast".
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:ThisIsASpamTrap@gmail.com>
| |
| Andrew Poelstra 2006-06-30, 6:56 pm |
| On 2006-06-30, Richard Bos <rlb@hoekstra-uitgeverij.nl> wrote:
> Andrew Poelstra <apoelstra@localhost.localdomain> wrote:
>
>
> No, it's giving it a different name. AFAIAA, the inode doesn't even
> change.
>
If you're sending a letter to someone, you use their address. If you're
sending data to a file, you use its name. You don't use the inode. For
all you care (assuming you aren't a filesystem designer), the inode itself
could be metaphysical, and could be changing position with every heartbeat
of the universe.
(My point is that a filename is more analogous to an address than an inode
is.)
Another justification for mv is that /actually/ moving the file (that is,
to another directory) is just as complex as changing the name; instead,
you edit the inode tables of two directories. This is no more a move than
renaming is.
>
> True, but irrelevant to renaming. If I remove the slice of pine saying
> "Dunroamin" in a brush letter from my house, and put in its place a
> faux-stone plaque saying "RLB MANSION" in faux-chiseled quadrata, I do
> not need to pack up the plates.
>
Unless you are lying, you will indeed need to move that wine from RLB
MANSION. If your guests ask for some RLB, and you give them what clearly
tastes like Dunroamin, they won't be very happy.
>
> I'd rather use a real editor, but that's another issue.
>
I hope you mean emacs or some other great editor, because I've spent all
day arguing with people promoting the merits of M$ notepad. I personally
like vi, but that's hardly a holy war I want to fight.
--
Andrew Poelstra <http://www.wpsoftware.net/blog>
To email me, use "apoelstra" at the above address.
"You people hate mathematics." -- James Harris
| |
| Richard Heathfield 2006-06-30, 6:56 pm |
| Kenneth Brody said:
<snip>
>
> I forget if it was here or elsewhere, but I saw someone point out
> (related to the recent "6/6/6" date) that "vi vi vi" is "the editor
> of the beast".
Um, 6/6/6 was over two thousand years ago. Recent in geological terms, I'll
grant you.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
| |
| Walter Roberson 2006-06-30, 6:56 pm |
| In article <slrnea9dfu.l1b.apoelstra@localhost.localdomain>,
Andrew Poelstra <apoelstra@localhost.localdomain> wrote:
>On 2006-06-30, Barry Schwarz <schwarzb@doezl.net> wrote:
[color=darkred]
[color=darkred]
>I can't justify dd, other than to say that it's a very powerful tool,
dd == "data duplicator" according to some sources. The syntax might
have been modeled on IBM's JCL "DD" statement.
--
Prototypes are supertypes of their clones. -- maplesoft
| |
| Joe Wright 2006-06-30, 6:56 pm |
| Richard Heathfield wrote:
> Kenneth Brody said:
>
> <snip>
>
> Um, 6/6/6 was over two thousand years ago. Recent in geological terms, I'll
> grant you.
>
No smiley? It was 24 days ago. :=)
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
| |
| Richard Heathfield 2006-06-30, 6:56 pm |
| Joe Wright said:
> Richard Heathfield wrote:
> No smiley? It was 24 days ago. :=)
No, it wasn't. 24 days ago, it was 6/6/2006, which is a very different date
indeed.
MY programs did NOT need Y2K mods, and will not need Y2.1K mods either.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
| |
| Walter Roberson 2006-06-30, 6:56 pm |
| In article <evadnZ8jj-wEwzjZRVnytA@bt.com>,
Richard Heathfield <invalid@invalid.invalid> wrote:
>Um, 6/6/6 was over two thousand years ago. Recent in geological terms, I'll
>grant you.
Two thousand years ago, that notation wouldn't have been
used for dates. If you are going to interpret as a date, you need
to use present-day interpretation of what it means, and in present-day
interpretation, there is no real standard that would require that
it be interpreted as anything other than sometime this century.
Now, if ISO date notation had been used...
--
All is vanity. -- Ecclesiastes
| |
| Keith Thompson 2006-06-30, 6:56 pm |
| roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) writes:
> In article <evadnZ8jj-wEwzjZRVnytA@bt.com>,
> Richard Heathfield <invalid@invalid.invalid> wrote:
>
>
> Two thousand years ago, that notation wouldn't have been
> used for dates. If you are going to interpret as a date, you need
> to use present-day interpretation of what it means, and in present-day
> interpretation, there is no real standard that would require that
> it be interpreted as anything other than sometime this century.
Sure there is. The order is ambiguous, but it's natural to interpret
the fields of 6/6/6 as the year, month, and date. The year 6 was 2000
years ago (even though it wasn't called that at the time).
There are also common notations in which 6/6/6 would mean June 6, 2006
(or June 6, 1906) -- but 06 is a more likely representation for the
year than just 6. The lack of a leading 0 on the year "6" makes it
more likely that it refers to the year 6 rather than 2006 (or 1996).
> Now, if ISO date notation had been used...
then it would have been even more obvious -- but ISO 8601 does allow
(but not encourage) the year to be represented by its last two digits.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
|
|
|
|
|