954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problems in C language

hello, I used to type my programs on console application.by C language and use
these libraries , ,, .etc and used these function (printf),(scanf) under library.. but then I wanted to know how they make programs on windows application by C language . I figure out they used another libraries .. like .and the functions that used under this library is different from which I used to make my program on it.so my qusetion is that :I need to know how many the libraries under C language until this day.. ? is there any location to know that.. ? and how I can run my programs that I made it on dos make run on windows .. what should I do..?

fromthatside
Newbie Poster
12 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

>so my qusetion is that :I need to know how many
>the libraries under C language until this day.. ?
It sounds like you just want to focus on Win32 for now. You can start here , but eventually you'll be checking MSDN regularly.

Note that GUI programming is not easy as there's quite a learning curve when coming from console applications.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

no, I don't like to focus on Win32 . but I would like to know how many libraries on C language until today is there any location.?

fromthatside
Newbie Poster
12 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

>but I would like to know how many libraries on C language until today is there any location.?
There are thousands upon thousands of C libraries. And no, there's no centralized location.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

ok.. but just I would like to know is
this library part form C or C++ language.?

fromthatside
Newbie Poster
12 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

is from the Win32 API.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

No, windows.h is definitely not part of the c/c++ standard.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
No, windows.h is definitely not part of the c/c++ standard.


ok. but why they say ..:programming under win32 using C language ..!
most of programs that made it on win32 used windows.h under C language .. what is that mean.?

fromthatside
Newbie Poster
12 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

>but why they say ..:programming under win32 using C language ..!
You're using the C language to access the Win32 API through a C interface (the header and library).

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

It just means you can use C language to build gui MS-Windows programs. You can also use other languages, such as C#, VB, php, C++, and others. The win32 api functions were made by Microsoft to be called by as many different programming languages as possible. windows.h is just a header file used within C and C++ language.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

I can understand from your answers .. it's just library under win32 that I can use it in different languages .. like C , C++,C# ,VB,etc... but when I use in C language I will use some functions .. that I can't use it when I'm using in C++ language.. etc.. is that right.?

fromthatside
Newbie Poster
12 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

The functions declared in windows.h can be used in all languges. windows.h is specific to C and C++. The other languages have a similar header file that is targeted to that language, but they all reference the same win32 api functions.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

do you mean there is no difference in any thing when I use in C langauge and when I use it in C++ ? , then why they say programming win32 by C and programming win32 by C++..!?

fromthatside
Newbie Poster
12 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

>do you mean there is no difference in any thing when I
>use in C langauge and when I use it in C++ ?
More or less.

>then why they say programming win32 by C and programming win32 by C++..!?
Probably because it's true. "Win32 by C" means a C program that uses Win32. Likewise, "Win32 by C++" means a C++ program that uses Win32. C and C++ are different languages, so it's a rather important distinction even if is usable in both.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

ok.. thank you I will try to find more information about this topic..

fromthatside
Newbie Poster
12 posts since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

Some addition.
The original MS windows.h header is a root of the lots of include files: windef.h, winbase.h, wingdi.h and others. In itself it contains few declarations.
Open these files (any) and search the __cplusplus identifier. It's the key point to understand why the single window.h used in C and C++ (different) languages.

The program in C++ can use functions written in C (but not vice versa). The C++ Standard requires that "The name _ _ cplusplus is defined to the value [tbd] when compiling a C++ translation unit" (defined as a macros). In other words you (and MS) can write headers with common for C and C++ preprocessor conditional statements which are "sensitive" to the compiled unit language.

All classic Windows API functions have C interface (written in C). For example (all-capital words are type aliases defined by typedef):

VOID GetSystemTime(LPSYSTEMTIME lpst);
VOID GetSystemInfo(LPSYSTEM_INFO  lpSystemInfo);

The program in C needs these prototypes. The program in C++ needs to know that these functions written in C:

extern "C" {
VOID GetSystemTime(LPSYSTEMTIME lpst);
VOID GetSystemInfo(LPSYSTEM_INFO  lpSystemInfo);
}

Let's invent common code:

#ifdef __cplusplus
extern "C" { /* skip this line if it's C code compiled */
#endif
VOID GetSystemTime(LPSYSTEMTIME lpst);
VOID GetSystemInfo(LPSYSTEM_INFO  lpSystemInfo);
#ifdef __cplusplus
} /* /* skip this line if it's C code compiled */
#endif

That's why C and C++ can use common system headers...

ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You