Sponsored Content
Top Forums Programming C++ : is what the meaning of #include<stdio.h>? Post 302766195 by Corona688 on Monday 4th of February 2013 10:41:24 AM
Old 02-04-2013
Why this is needed in C goes to the heart of how C compiles and links.

Including <stdio.h> tells the compiler that "somewhere, there exists a function named fgets, which takes arguments of char *, int, and FILE *". So the compiler will assume that function exists, not complain about it when you use it, and get the arguments right without guessing. It doesn't need the function itself yet.

Later, when it links your program, it assembles everything from pieces and when it hunts for this name, it will find it in the standard libc library.

Once it's done piecing all these bits together, what it gives you is a program that can be loaded in memory, which is the bit you actually run.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

what the meaning of #*

can some one please tell the meaning of the second statement i.e n=${m#*=} i couldnt get the meaning of the #*= 1.) m="mohit=/c/main/issue" echo $m result ----------- mohit=/c/main/issue 2.) n=${m#*=} echo $n RESULT ------- /c/main/issue (1 Reply)
Discussion started by: narang.mohit
1 Replies

2. Shell Programming and Scripting

meaning of !*

can someone please tell what !* means in shell syntax. Regards, (3 Replies)
Discussion started by: busyboy
3 Replies

3. Programming

Atomic Read and Write with stdio

hi guys. can we use fread and fwrite with pipes to write data more than PIPE_BUF atomically since they lock FILE object until I/O operation finish? (1 Reply)
Discussion started by: majid.merkava
1 Replies

4. Programming

stdio.h vs unistd.h I/O

Hi guys. To work with physical files, sockets, pipes, ... which library is good? stdio or unistd stdio.h functions perform buffering and rationally should be better than unistd.h routines. but i am wondering why all UNIX programming books use unistd.h routines for almost all types of I/O... (7 Replies)
Discussion started by: majid.merkava
7 Replies

5. Programming

FILE structure - stdio.h

Hi All, I am new to linux and Programming. Inside the file stdio.h, there is a description about FILE structure. Which has many internal data members like _p, _r, _flags etc. I have written a sample code to find out the contents of the FILE structure. It opens a sample file ( FILE *fp ),... (5 Replies)
Discussion started by: nikunjbadjatya
5 Replies

6. Shell Programming and Scripting

^$$ meaning

Hi , Can anyone please let me know whta the follwoing piece of code for ScriptName=${0##*/} if pgrep -f "$ScriptName" | grep -v "^$$\$" ; then echo `date`": Sctipt $ScritName is already runnig" exit fi Thnx a lot in advance Please use code tags when posting data and code... (8 Replies)
Discussion started by: Pratik4891
8 Replies

7. UNIX for Dummies Questions & Answers

meaning of <<!

Hi all, I wanna know the meaning of the last word "<<! " sudo su - user <<! please help on this !!!! (1 Reply)
Discussion started by: sudharson
1 Replies

8. Programming

stdio.h not found on Solaris 11

Hi friends, I hope u r doing well. I have just installed Solaris 11, and it seems that solaris 11 doesn't come with all the packages, one has to do everything manually. I download gcc from sunfreeware.com and installed it. After setting up the path variable, I tried to compile the hello world... (4 Replies)
Discussion started by: gabam
4 Replies

9. Solaris

fatal error: stdio.h: No such file or directory

Trying to compile a C program recievin this hello.c:1:19: fatal error: stdio.h: No such file or directory gcc is installed on the system. echo $PATH /usr/bin:/usr/sbin:/usr/gcc/4.5/include/c++/4.5.2/tr1 root@Sol11swtb01:/media/NO NAME/Programming/C/Testing# cd... (2 Replies)
Discussion started by: Fingerz
2 Replies

10. Programming

Ignoring the stdio.h file in a C file

I am facing a problem in the below given code. int main() { printf("\nHello Geeks\n\n") ; return 0 ; } In the above mentioned code i left including "#include ". And if i compile and execute this piece of code, the output is printed as expected. But "#include " being the most important... (7 Replies)
Discussion started by: Raj 89
7 Replies
CC(1)							      General Commands Manual							     CC(1)

NAME
cc - C compiler (2BSD) SYNOPSIS
cc [ option ] ... file ... DESCRIPTION
Cc is the UNIX C compiler. Cc accepts several types of arguments: Arguments whose names end with `.c' are taken to be C source programs; they are compiled, and each object program is left on the file whose name is that of the source with `.o' substituted for `.c'. The `.o' file is normally deleted, however, if a single C program is compiled and loaded all at one go. In the same way, arguments whose names end with `.s' are taken to be assembly source programs and are assembled, producing a `.o' file. The following options are interpreted by cc. See ld(1) for load-time options. -c Suppress the loading phase of the compilation, and force an object file to be produced even if only one program is compiled. -w Suppress warning diagnostics. -p Arrange for the compiler to produce code which counts the number of times each routine is called. If loading takes place, replace the standard startup routine by one which automatically calls monitor(3) at the start and arranges to write out a mon.out file at normal termination of execution of the object program. An execution profile can then be generated by use of prof(1). -O Invoke an object-code improver. -S Compile the named C programs, and leave the assembler-language output on corresponding files suffixed `.s'. -M Run only the macro preprocessor on the named C programs, requesting it to generate Makefile dependencies and send the result to the standard output. -E Run only the macro preprocessor on the named C programs, and send the result to the standard output. -C prevent the macro preprocessor from eliding comments. -o output Name the final output file output. If this option is used the file `a.out' will be left undisturbed. -Dname=def -Dname Define the name to the preprocessor, as if by `#define'. If no definition is given, the name is defined as "1". -Uname Remove any initial definition of name. -Idir `#include' files whose names do not begin with `/' are always sought first in the directory of the file argument, then in directo- ries named in -I options, then in directories on a standard list. -Ldir Library archives are sought first in directories named in -L options, then in directories on a standard list. -Bstring Find substitute compiler passes in the files named string with the suffixes cpp, c0, c1 and c2. If string is empty, use a standard backup version. -t[p012] Find only the designated compiler passes in the files whose names are constructed by a -B option. In the absence of a -B option, the string is taken to be `/usr/c/'. Other arguments are taken to be either loader option arguments, or C-compatible object programs, typically produced by an earlier cc run, or perhaps libraries of C-compatible routines. These programs, together with the results of any compilations specified, are loaded (in the order given) to produce an executable program with name a.out. FILES
file.c input file file.o object file a.out loaded output /tmp/ctm? temporary /lib/cpp preprocessor /lib/c[01] compiler /lib/c2 optional optimizer /lib/crt0.o runtime startoff /lib/mcrt0.o startoff for profiling /lib/libc.a standard library, see intro(3) /usr/lib/libc_p.aprofiling library, see intro(3) /usr/include standard directory for `#include' files mon.out file produced for analysis by prof(1) SEE ALSO
B. W. Kernighan and D. M. Ritchie, The C Programming Language, Prentice-Hall, 1978 B. W. Kernighan, Programming in C--a tutorial D. M. Ritchie, C Reference Manual monitor(3), prof(1), adb(1), ld(1), as(1) DIAGNOSTICS
The diagnostics produced by C itself are intended to be self-explanatory. Occasional messages may be produced by the assembler or loader. BUGS
The compiler currently ignores advice to put char, unsigned char, long, float, or double variables in registers. 3rd Berkeley Distribution June 7, 1985 CC(1)
All times are GMT -4. The time now is 06:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy