473,581 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ 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 4395
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_Keit h) 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

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

Similar topics

6
1560
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 which the user may easily extend. It also tries to solve few problems which exist in the standard string and have been discussed during the recent...
43
4935
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 libraries. I'm not sure if that's a good thing or not. AFAIK, most of Qt is compatable with the Standard Library. That is, QLT can interoperate with...
5
3522
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 function calls) are part of the (Unix) system calls. The cause of my confusion is that for example stdio.h is considered
25
2638
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 platform API call? I was able to do this in Windows with a Windows.h function, but I want to also do it on Linux/Unix as well. I won't ask for...
50
3477
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 intertwined with the OS (string.h and other headers are there). So does this mean that when I program in C and use standard library functions, it's...
6
2236
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 one vendor and the standard C libraries from the different vendor ? Also, the C standard (N869), page 164, refers to "standard headers". Do I get...
9
8284
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 make few other functions reentrant on Linux platform? I have searched a lot on the web for it but without any success. Man page of signal(2) has...
11
1931
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 header references in the compilation string. For instance the standard hello.c #include <stdio.h> int main()
72
4387
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: http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx jacob
20
3507
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 part of the Unix thought process, but is Mnot essential for a working OS. There are no Standard C Library functions for process forking or...
0
7882
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7914
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8181
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5366
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3835
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1410
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1145
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.