473,473 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Library Functions .... Standard ??

Library Functions provided by the compiler, are they portable?
i.e. is there any ANCI C standards for these functions.

eg. getch() function defined in <conio.h> header file works fine in
windows C compiler but gcc compiler in linux does not recognise it.

gcc compiler does not define <conio.h> header file.

Apr 21 '06 #1
11 4377
santosh wrote:
Library Functions provided by the compiler, are they portable?
i.e. is there any ANCI C standards for these functions.

eg. getch() function defined in <conio.h> header file works fine in
windows C compiler but gcc compiler in linux does not recognise it.

gcc compiler does not define <conio.h> header file.

If you stick with the standard C library as specified in the C standard,
your code will be portable.

gcc doesn't provide <conio.h>, Windows does.

--
Ian Collins.
Apr 21 '06 #2

santosh wrote:
Library Functions provided by the compiler, are they portable?
Not all. There may be some functions specific to your compiler like
getch() which you have pointe dout below.
i.e. is there any ANCI C standards for these functions.

eg. getch() function defined in <conio.h> header file works fine in
windows C compiler but gcc compiler in linux does not recognise it.

gcc compiler does not define <conio.h> header file.


http://www-ccs.ucsd.edu/c/lib_over.html

Apr 21 '06 #3
"santosh" <sa***********@gmail.com> writes:
Library Functions provided by the compiler, are they portable?
i.e. is there any ANCI C standards for these functions.
Some are standard, some aren't. Search for "n1124.pdf" to see the
most current draft of the standard; section 7 defines the standard
library. Implementations typically provide additional functions.
(Ideally your documentation should tell you which functions are
standard and which ones are not.)
eg. getch() function defined in <conio.h> header file works fine in
windows C compiler but gcc compiler in linux does not recognise it.

gcc compiler does not define <conio.h> header file.


Neither getch() nor <conio.h> is defined by the C standard.

--
Keith Thompson (The_Other_Keith) ks***@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.
Apr 21 '06 #4
santosh wrote:
Library Functions provided by the compiler, are they portable?
i.e. is there any ANCI C standards for these functions.

eg. getch() function defined in <conio.h> header file works fine in
windows C compiler but gcc compiler in linux does not recognise it.

gcc compiler does not define <conio.h> header file.

No, there is no standard on the contents of headers provided by the
compiler, which are not described by the standard. Nor is there any
standard which says a gcc installation, on Windows or elsewhere, should
define such functions in the same named header file as a compiler you
associate more closely with a certain operating system.
gcc itself is parsimonious about providing headers not defined in the
standard. Quite likely, a header and library for a nonstandard function
like this is optional and can be installed or not, as you choose.
Apr 21 '06 #5
santosh said:
Library Functions provided by the compiler, are they portable?
Not all of them, no.
i.e. is there any ANCI C standards for these functions.
You mean ANSI? Well, all the ones that are defined by ANSI are portable
across all hosted implementations, and so *must* be provided by the
implementation.
eg. getch() function defined in <conio.h> header file works fine in
windows C compiler but gcc compiler in linux does not recognise it.
It would if you added #include <curses.h> BUT it wouldn't be the same
getch(). It doesn't do the same job. That's one slightly less obvious snag
with non-portable functions such as getch().
gcc compiler does not define <conio.h> header file.


Right.

--
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)
Apr 21 '06 #6
Ian Collins said:
gcc doesn't provide <conio.h>, Windows does.


Not true. It is supplied by some implementations, not by the OS. In any
case, it pre-dates 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)
Apr 21 '06 #7
Richard Heathfield wrote:
Ian Collins said:

gcc doesn't provide <conio.h>, Windows does.

Not true. It is supplied by some implementations, not by the OS. In any
case, it pre-dates Windows.

OK, half true - gcc doesn't provide it :)

If rusty grey cells can be trusted, I think it was a DOS header?

--
Ian Collins.
Apr 21 '06 #8
Ian Collins wrote:
Richard Heathfield wrote:
Ian Collins said:

gcc doesn't provide <conio.h>, Windows does.

Not true. It is supplied by some implementations, not by the OS. In any
case, it pre-dates Windows.

OK, half true - gcc doesn't provide it :)

If rusty grey cells can be trusted, I think it was a DOS header?


It was in Turbo C 1.0 & 2.0 and Borland C++ version 3.1. Used to provide
"windowing" functions in DOS or in a DOS box under Windows. Provided
things like gotoXY(), TextColor(), TextBackground(), window() and so on.

As far as I know that was the only place conio.h existed

Alan

Apr 21 '06 #9
Ian Collins said:
Richard Heathfield wrote:
Ian Collins said:

gcc doesn't provide <conio.h>, Windows does.

Not true. It is supplied by some implementations, not by the OS. In any
case, it pre-dates Windows.

OK, half true - gcc doesn't provide it :)

If rusty grey cells can be trusted, I think it was a DOS header?


Not so. It is supplied by some implementations, not by the OS.

Borland provided a conio.h header in Turbo C. So, I believe, did Microsoft
in their own (cough) implementation - but with different contents. DJGPP
also provides one which consciously emulates Borland's.

And Zog C provides one too. See the following URL:

http://dspace.dial.pipex.com/town/green/gfd34/art/

Click on Software link when you get there - don't worry, it's just passive
HTML.

--
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)
Apr 21 '06 #10
Richard Heathfield a écrit :
Ian Collins said:

Richard Heathfield wrote:
Ian Collins said:

gcc doesn't provide <conio.h>, Windows does.
Not true. It is supplied by some implementations, not by the OS. In any
case, it pre-dates Windows.


OK, half true - gcc doesn't provide it :)

If rusty grey cells can be trusted, I think it was a DOS header?

Not so. It is supplied by some implementations, not by the OS.

Borland provided a conio.h header in Turbo C. So, I believe, did Microsoft
in their own (cough) implementation - but with different contents. DJGPP
also provides one which consciously emulates Borland's.

And Zog C provides one too. See the following URL:

http://dspace.dial.pipex.com/town/green/gfd34/art/

Click on Software link when you get there - don't worry, it's just passive
HTML.


Awesome. I think I have to scrap lcc-win32 and buy some Death Stations
with associated compiler.

jacob
Apr 21 '06 #11

santosh wrote:
Library Functions provided by the compiler, are they portable?
i.e. is there any ANCI C standards for these functions.

eg. getch() function defined in <conio.h> header file works fine in
<conio.h> or Console Input/Output header is normally found in Windows
based C Compilers. But, frankly it has nothing to do with any OS, maybe
in the near future a header by the name "<conio.h>" might get shipped
with Linux based C Compliers. But still till date it doesn't come under
the standerd C.
windows C compiler but gcc compiler in linux does not recognise it.

For your information gcc implementation can be found for Windows as
well.

Apr 21 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: shablool | last post by:
Hi all! The Strinx library is an efficient and easy-to-use string library. It is written in C++, using modern template approach. It uses a class hierarchy to implement a set of string objects...
43
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own...
5
by: markus | last post by:
Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and...
25
by: JeffS | last post by:
Honest, I scoured the comp.lang.c.faq for this but found nothing. :) Is there a library function for placing the cursor position in the console? Or is it something that can only be done with a...
50
by: Romeo Colacitti | last post by:
Is the C library of most OSes (i.e, unix type OSes) implemented at the very low kernel or just outside kernel level? Looking through the source tree of Linux/BSDs it seems like the C library is...
6
by: junky_fellow | last post by:
On what basis it is decided that a particular funtion should be a part of Standard C library ? Do I get these standard C libraries along with the C compiler ? Or I can use the c complier from...
9
by: TheOne | last post by:
Would anyone please point me to a list of reentrant C library functions? I want to know which C library functions are safe to use inside a signal handler across all platforms. Does GNU C library...
11
by: Eigenvector | last post by:
I apologize if this is a trivial question, but it's always made me wonder when I have to compile my code. There are some #includes that you don't really need to reference in your library and...
72
by: jacob navia | last post by:
We have discussed often the proposition from Microsoft for a safer C library. A rationale document is published here by one of the members of the design team at microsoft:...
20
by: J de Boyne Pollard | last post by:
MThe library functions which are included to allow process Mlaunch, forking, and termination, imply that it is both Mpossible and desirable for a process to fork itself. This is Ma fundamental...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.