To output "Hello, World!" at window

J

James Kuyper

On 04/15/2011 04:42 AM, Chris H wrote:
....
NO. K&R was NEVER standard C. ANSI 89 was not either. That was a
local US standard.

A local standard is still, by definition, a standard.

....
Or hardware or IO or in fact anything much. It does not mention
Standard C which has it's own group.

Which newsgroup is that? comp.std.c is for the discussion of the C
standard - the actual document defining the standard C language. It's
not for the discussion of standard C (that is, how to use the language
defined by that standard).
 
C

Chris H

James Kuyper said:
On 04/15/2011 04:42 AM, Chris H wrote:
...

A local standard is still, by definition, a standard.

Is a local standard relevant in an International News Group?
If so the "local" standard used by various compiler maker is also valid.

SO we can discuss anyone's version of C.
Which newsgroup is that? comp.std.c is for the discussion of the C
standard - the actual document defining the standard C language. It's
not for the discussion of standard C (that is, how to use the language
defined by that standard).

If you say so... I don't
 
J

James Kuyper

Is a local standard relevant in an International News Group?

Perhaps not, but being an irrelevant standard is not the same as not
being a standard.
If so the "local" standard used by various compiler maker is also valid.

SO we can discuss anyone's version of C.

This is an unmoderated newsgroup without a charter - we can discuss
stock futures or fashion accessories if we want to.

However, code that is specific to a particular implementation of C is
best discussed in a forum specific to that implementation, you'll get
better results there. I won't claim that this newsgroup is a good place
to discuss anything - it's flooded with off-topic discussions and
infested with trolls. However, it's the closest thing that I'm aware of
to being an appropriate place to discuss aspects of C that are not
implementation-specific. comp.lang.c.moderated is, in principle, a
better place for such discussions, but it's not very popular, and the
moderation policy is sufficiently lenient to allow it to suffer from
most of the same problems as comp.lang.c itself.
If you say so... I don't

It doesn't matter whether you say it. Unlike comp.lang.c, comp.std.c
does have a charter, and it does say that.
 
K

Kenny McCormack

....
It doesn't matter whether you say it. Unlike comp.lang.c, comp.std.c
does have a charter, and it does say that.

It is always true that when you tell the person with whom you are debating
that you don't care what they say, the discussion is over.
 
S

Seebs

COMPUTER.LANGUAGE.C I dont see the "Standard C" anywhere in the name.

So? C is a portable language. If a program is in C, it should be accepted
by C compilers. Questions about the Windows graphics API apply to people
using languages other than C, but they don't apply to using C on Unix
machines. Clearly, they are questions about Windows, not about C.

-s
 
M

Martin Ambuhl

In message<[email protected]>, James Kuyper

If you say so... I don't

You can make up your own world if you want, but I thought you claimed to
"live in reality". In reality, comp.std.c is for discussion of the
standard, and comp.lang.c is for discussion of the language defined by
that standard. Your world in which something else is the case is not
"in reality", and pretending that it is only marks you as delusional.
 
S

Seebs

You can make up your own world if you want, but I thought you claimed to
"live in reality". In reality, comp.std.c is for discussion of the
standard, and comp.lang.c is for discussion of the language defined by
that standard. Your world in which something else is the case is not
"in reality", and pretending that it is only marks you as delusional.

The description is pretty clear. comp.std.c is for discussion of the C
standard, just as other std groups are for discussions of standards.

A discussion of the standard is not the same thing as a discussion of the
thing it is a standard for.

Analogy time!

The legislature defines laws about how to run a business. This does
not mean that, if you want to restrict discussion of how to run a business
to legal ways to do so, you should be discussing this in the legislature,
not in a forum about businesses.

-s
 
K

Kenny McCormack

You can make up your own world if you want, but I thought you claimed to
"live in reality". In reality, comp.std.c is for discussion of the
standard, and comp.lang.c is for discussion of the language defined by
that standard. Your world in which something else is the case is not
"in reality", and pretending that it is only marks you as delusional.

One need never look far for evidence that Marty the Ambulance is insane.
 
M

Martin Ambuhl

One need never look far for evidence that Marty the Ambulance is insane.

After being absent for 2 years, I am happy to see that Kenny has not
changed his rant about regulars (even though he by now must know that he
is wrong) or his form of "reasoned" argument.
 
C

Chris H

Kenny McCormack said:
One need never look far for evidence that Marty the Ambulance is insane.

He has an interesting argument though.
He says I am delusional.
I am also on the ISO C committee.
So where does that leave his argument?
 
K

Keith Thompson

Kenneth Brody said:
In message <[email protected]>, Joachim Schmitz
So what is C? Obviously the language described by K&R, later
standardardized into the ANSI/ISO C89- and the C99-standard. [...]
Neither of which mentions graphics or windows.

Or hardware or IO or in fact anything much. It does not mention
Standard C which has it's own group.
[...]

What is this other group of which you speak?[1]

The problem with saying something equivalent to "if I can use a C
compiler to build my program, it's 'C', and therefore topical on
comp.lang.c", is how far do you take this? How many third-party
libraries are to be discussed? How many platform-specific extensions
are topical?
[snip]

I find it interesting how rarely we actually see people rudely tell
posters that their posts are off-topic, and how much bandwidth is
spent on complaints from a few people about how rude the "regulars"
are.

Really, the question that spawned this thread is much more likely
to get good answers if it's posted to a system-specific forum.
What's wrong with saying so? (I'm guessing it's probably an MS
Windows question, but the OP didn't provide enough information to
be sure of that.)

In September of 2007, Richard Heathfield posted a survey in an
article with the subject "Should we broaden the topicality of this
group?". In October, he posted a summary of the results, under the
subject "Topicality discussion - summary". There was, of course, no
universal consensus, but a strong majority of those who participated
expressed a desire for fairly narrow topicality guidelines (actually
narrower than what RH was advocating at the time).

In the absence of a charter, I suggest that the decision of what is
or is not topical should be determined by the general consensus of
those who actually participate. (The trolls, as I recall, didn't
take part in the survey, but still whined about the results.)

It's been several years. If someone wants to conduct a new survey,
go ahead. I don't think much has changed.
 
S

Seebs

After being absent for 2 years, I am happy to see that Kenny has not
changed his rant about regulars (even though he by now must know that he
is wrong) or his form of "reasoned" argument.

I dunno, I think he's improved a lot. Name-derived insults are something a
lot of kids can't manage before second or third grade.

-s
 
B

BartC

Really, the question that spawned this thread is much more likely
to get good answers if it's posted to a system-specific forum.
What's wrong with saying so? (I'm guessing it's probably an MS
Windows question, but the OP didn't provide enough information to
be sure of that.)

There are numerous different approaches to the OP's problem. Perhaps one of
the them is to use the native Windows API for these things (which used to be
defined in C and now I believe uses C++, or possibly .NET; I haven't kept
up). But redirecting him to a win32 group seems even less appropriate than
asking in a C language group (and last I looked, they weren't very active,
perhaps because few people program graphics directly in Windows these days).
 
K

Keith Thompson

BartC said:
There are numerous different approaches to the OP's problem. Perhaps one of
the them is to use the native Windows API for these things (which used to be
defined in C and now I believe uses C++, or possibly .NET; I haven't kept
up). But redirecting him to a win32 group seems even less appropriate than
asking in a C language group (and last I looked, they weren't very active,
perhaps because few people program graphics directly in Windows these days).

I just took a brief look at comp.os.ms-windows.programmer.win32,
and it seems to have roughly as much activity as comp.lang.c.

C itself (i.e., the language and the standard library) provides
no mechanasm to create a window. Whatever mechanism happens to
be available on the OP's system can probably be invoked from a
C program. That doesn't make it a C question.

So where you suggest he should ask?

Actually, the OP hasn't posted again since the original question.
Perhaps he found an answer to his question, or perhaps he's lost
interest. I suggest that any further speculation is pointless
unless he comes back and clarifies what he's looking for.
 
B

BartC

Keith Thompson said:
I just took a brief look at comp.os.ms-windows.programmer.win32,
and it seems to have roughly as much activity as comp.lang.c.

It seems to have only 7 new threads since the beginning of the month;
comp.lang.c has had about 50. And this win32 group presumably deals with
*everything* to do with win32, of which graphics is a small part.

I have used microsoft.public.win32.programmer.gdi in the past; at the moment
that seems to have had only 7 new threads this year! So Windows graphics
groups seem very quiet.
C itself (i.e., the language and the standard library) provides
no mechanasm to create a window. Whatever mechanism happens to
be available on the OP's system can probably be invoked from a
C program. That doesn't make it a C question.

So where you suggest he should ask?

Difficult to say. A win32 group might be worth asking in (even if just to be
redirected elsewhere), but we don't really want to inflict low-level Windows
programming on anyone. That assumes he needs to use C at all; perhaps
another language with graphics built-in, or more standardised, might be more
appropriate. C# perhaps?
 
J

James Kuyper

He has an interesting argument though.
He says I am delusional.

That was a bit excessive.
I am also on the ISO C committee.
So where does that leave his argument?

He didn't really make one; nor has anyone else. He merely reiterated the
same truth that several other people have told you about. If you don't
believe that comp.std.c is just for discussion of the C standard - if
you believe that discussions of standard C are on-topic in that forum;
then that just means that you're not very familiar with comp.std.c.

I've posted literally thousands of messages to comp.std.c since 1996
(Google groups only shows 332 messages since 2000, but GG is suffering
from amnesia; I've got 3218 saved messages in my folders, and there's a
lot more that I couldn't save for one reason or another). In questions
about comp.std.c topicality, that's a more relevant credential than
membership of the ISO C committee. Of course, that doesn't mean that I'm
necessarily right about comp.std.c topicality, any more than you're
necessarily right about issues related to the C committee.

Google groups says you've only posted 65 messages to comp.std.c, but I'm
not sure it's being any more accurate about you than it was about me.
 
J

J. J. Farrell

Chris said:
He has an interesting argument though.
He says I am delusional.
I am also on the ISO C committee.
So where does that leave his argument?

Oh, you really don't want to go down that path ...
 
G

Geoff

#include <stdio.h>
int main()
{
printf("Hello, World!\n");
system("Pause");
return 0;
}

I install Visual C++ 2010 Express, now.

And, I test above source.

So, I want to output "Hello, World!" at window (such as Notepad), not
commandline.

How to?

I am begginer. :)

This question is off-topic for comp.lang.c. You would be better off
asking in a Visual Studio or Win32 programming group.

To partially answer your question: You have built a "console program",
this creates a window but it's not a windowed program. To create a
windowed program you must use functions of the Windows API or the
Microsoft Foundation Classes (MFC) or the .NET API. These API are not
within the C standard.

You can also find sample Windows programs within the Visual C++ IDE or
directly at http://archive.msdn.microsoft.com/vcsamples
 
S

Stefan Ram

Geoff said:
This question is off-topic for comp.lang.c. You would be better off
asking in a Visual Studio or Win32 programming group.

It is not actually off-topic to ask how to do something with C,
just because the answer is »This can't be done with C«,
the question whether it can be done with C still is on topic.

However, a problem is that the question is not posed in a
way I can understand because the phrase »to output some text
at window« does not have a common meaning in the English
language that I know. I even wonder whether it is
grammatical, it seems to lack the artical in front of
»window« (such as in »at a window«), but OTOH there are also
English phrases such as »at gunpoint« where there also is no
article between »at« and the noun.

When a console program outputs text under Microsoft®
Windows, this text /is/ written into a window! (It is
written into the console window.) So, if the question would
be how to write text /into/ some window, the answer might be
that the program already does this under Microsoft® Windows
(unless started in a console in full screen mode).

However, the OP does not want to write »into a window«,
but »at window«, and I just do not know what this means;
but then I am not a native speaker of English.
 
G

Geoff

It is not actually off-topic to ask how to do something with C,
just because the answer is »This can't be done with C«,
the question whether it can be done with C still is on topic.

However, a problem is that the question is not posed in a
way I can understand because the phrase »to output some text
at window« does not have a common meaning in the English
language that I know. I even wonder whether it is
grammatical, it seems to lack the artical in front of
»window« (such as in »at a window«), but OTOH there are also
English phrases such as »at gunpoint« where there also is no
article between »at« and the noun.

When a console program outputs text under Microsoft®
Windows, this text /is/ written into a window! (It is
written into the console window.) So, if the question would
be how to write text /into/ some window, the answer might be
that the program already does this under Microsoft® Windows
(unless started in a console in full screen mode).

However, the OP does not want to write »into a window«,
but »at window«, and I just do not know what this means;
but then I am not a native speaker of English.

As a native speaker of English and as someone somewhat familiar with
how Chinese speakers phrase their English after being married to one
for 31 years, I took the OP to mean he wants to print text to a
Windows application the same way the Notepad application does it and
not as a console application.

In this context, the answer is to create a Windows application project
and not a console application project and the details of this are
relevant to the Visual Studio IDE and the Win32 API and these details
are outside the scope of the comp.lang.c group discussion.

If you use the IDE wizard to create a new Win32 project it will create
most of the window program for you. Then you must write the code to
handle the WM_PAINT messages your window will receive. This code is
placed in the WndProc callback function. An example of a minimal
WndProc that prints a "Hello Windows" would look something like this:

//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
RECT wr;

switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd,
About);
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
GetClientRect(hWnd, &wr);
DrawText(hdc, _T("Hello Windows!"), -1, &wr,
DT_CENTER | DT_VCENTER | DT_SINGLELINE);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,220
Latest member
AugustinaJ

Latest Threads

Top