473,378 Members | 1,321 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

How do I know which library file am i suppose to call?

Hello guys. This is my beginning with d C programming and i m confused abt these library functions. I actually dont understand how am i suppose to know which library file i have to call. I only know "stdio.h" but i have also come up with others like "genlib.h" but i dont know when to use them.
I hope u understand what i am saying. i would feel very glad if you'd help me. Thanks.
Sep 20 '07 #1
4 1476
sicarie
4,677 Expert Mod 4TB
You include libraries when you need to use their functionality. For instance, if you are using sockets, you include 'sys/socket.h'. Then you can instantiate their objects and use their methods.

All your includes go at the top of the program, and then you call the object and methods in the program as needed.
Sep 20 '07 #2
arnaudk
424 256MB
C without any libraries contains only a very limited set of functions. For example, if you want to print some output to the screen, you'll need to use the printf() function. This function becomes available only when you #include <stdio.h> as printf() is defined in the header file stdio.h. (The header files themselves are tied to libraries which differ for each operating system, but you don't need to know this so long as your C compiler is installed and working properly).

There many are other libraries which come as standard with any C compiler, math.h defines mathematical functions such as sin() cos() etc. stdlib.h defines some useful functions like atoi() which converts the character '1' to its integer value 1, the exit() function which terminates the program safely by flushing all buffers and closing all open streams, etc. There are many others, time.h for reading the clock, float.h, limits.h... The basic ones are described in most C programming books, you should familiarize yourself with the basic ones as you will need them most often. And remember, Google is your friend.

It is also possible to write your own header files in order to split your program over several files as it grows, and there are also many other seperately available header files for doing more complex things, check out the Gnu C library (GCL) and Gnu Scientific Library (GSL), for example.
Sep 20 '07 #3
C without any libraries contains only a very limited set of functions. For example, if you want to print some output to the screen, you'll need to use the printf() function. This function becomes available only when you #include <stdio.h> as printf() is defined in the header file stdio.h. (The header files themselves are tied to libraries which differ for each operating system, but you don't need to know this so long as your C compiler is installed and working properly).

There many are other libraries which come as standard with any C compiler, math.h defines mathematical functions such as sin() cos() etc. stdlib.h defines some useful functions like atoi() which converts the character '1' to its integer value 1, the exit() function which terminates the program safely by flushing all buffers and closing all open streams, etc. There are many others, time.h for reading the clock, float.h, limits.h... The basic ones are described in most C programming books, you should familiarize yourself with the basic ones as you will need them most often. And remember, Google is your friend.

It is also possible to write your own header files in order to split your program over several files as it grows, and there are also many other seperately available header files for doing more complex things, check out the Gnu C library (GCL) and Gnu Scientific Library (GSL), for example.
Can u plz give me the list of basic library functions?
Sep 20 '07 #4
sicarie
4,677 Expert Mod 4TB
Can u plz give me the list of basic library functions?
Did you bother to follow the 'GNU C Library' link above?
Sep 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Robert | last post by:
Python doesn't know the class of a method when container not direct class attribute: >>> class X: .... def f():pass .... g=f .... l= .... >>> X.g <unbound method X.f>
1
by: Sweep | last post by:
A question about linking with a static library that uses code from another static library. Suppose we have files A.h and A.cpp defining class A: ////////////////////// // A.h class A {...
8
by: Robert A Riedel | last post by:
I have an application that requires a DLL and an executable that uses the DLL, both of which were implemented in Visual C++ using unmanged code. Both the executable and the DLL are linked with...
36
by: lovecreatesbeauty | last post by:
In the C programming language, I/O operation functions are declared in stdio.h, for example, fopen(), fclose(), fwrite(), fread(), fseek() ... But another set of I/O functions are also defined in...
0
by: JosAH | last post by:
Greetings, the last two article parts described the design and implementation of the text Processor which spoonfeeds paragraphs of text to the LibraryBuilder. The latter object organizes, cleans...
31
by: Francine.Neary | last post by:
One interesting thing to come out of the recent "Alignment" thread is that it is impossible to write a portable replacement for malloc in "user space" (not sure what the right term is - I mean an...
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...
20
by: Nickolai Leschov | last post by:
Hello all, I am programming an embedded controller that has a 'C' library for using its system functions (I/O, timers, all the specific devices). The supplied library has .LIB and .H files. ...
40
by: Angus | last post by:
Hello I am writing a library which will write data to a user defined callback function. The function the user of my library will supply is: int (*callbackfunction)(const char*); In my...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.