Home Answers Viewqa Ajax Main function parameter in C language

 
 


Victor
Main function parameter in C language
1 Answer(s)      3 years and 7 months ago
Posted in : Ajax

View Answers

December 4, 2009 at 1:01 PM


Hi Friend,

int main(int argc, char **argv)

The main function serves as the starting point for program execution. It usually controls program execution by directing the calls to other functions in the program. A program usually stops executing at the end of main, although it can terminate at other points in the program.The parameters argc, argument count, and argv, argument vector[1], respectively give the number and value of the program's command-line arguments.

The fgetpos function gets the current value of the stream argument?s file-position indicator and stores it in the object pointed to by pos. The fsetpos function can later use information stored in pos to reset the stream argument?s pointer to its position at the time fgetpos was called.


Here is an example of fsetpos();

#include <stdio.h>

int main (){
FILE * pFile;
fpos_t position;

pFile = fopen ("myfile.txt","w");
fgetpos (pFile, &position);
fputs ("That is an example of fsetpos() function",pFile);
fsetpos (pFile, &position);
fputs ("This",pFile);
fclose (pFile);
return 0;
}

Here is an example of fgetpos():

#include <stdio.h>
#include <conio.h>
int main ()
{
FILE * pFile;
int c;
int n;
fpos_t pos;

pFile = fopen ("myfile.txt","r");
if (pFile==NULL) perror ("Error opening file");
else
{
c = fgetc (pFile);
printf ("1st character is %c\n",c);
fgetpos (pFile,&pos);
fsetpos (pFile,&pos);
c = fgetc (pFile);
printf ("2nd character is %c\n",c);

fclose (pFile);
}
getch();
return 0;

}
Thanks









Related Pages:
Main function parameter in C language - Ajax
Main function parameter in C language  Please let me know how...; Hi Friend, int main(int argc, char **argv) The main function serves... of fgetpos(): #include #include int main () { FILE * pFile; int c
C language-qsort and bsearch function - Ajax
C language-qsort and bsearch function  Explain qsort and bsearch function doing examples with character array.please also answer my previous question on main()parameters.thanks.  Hi Friend, bsearch function
C Language
C Language  What's the right declaration for main()? Is void main() correct? in C language ? please help me sir ! Thank You
bsearch() function in C
bsearch() function in C Programming Language This section demonstrates the use bsearch() function in C. This searches function the given key in the array... by b is greater than the a, it will return -1. In the main function, user
C language
C language  i want that when i hit any key only * to be print not the hit key in c language   The given example will display aestricks... main() { char data[15]; /* max length 14 characters say */ int index
C Pointer to a function
. As you know  that every function defined in C language have a base address...;return a*b*c; } void main() {   int (*function... C Pointer to a function   
Understanding public static void main function
Understanding public static void main function       The public static void main function is important function in Java programming language. In this section we will learn about main
C Language - Java Beginners
C Language  1. What are extension files? Give examples. 2. What is operating system? What are the different types available? 3. What is the purpose of operating system? 4. What is the function of operating system? 5
main function
main function  Give me the description of public static void main(Strings args
Objective-C program with multiple parameter
Objective-C program with multiple parameter       Objective-C enables programmer to use method... method for more than one parameter -(int) sum: (int) a andb: (int) b andc:(int)c
main function defnition in class - Java Beginners
main function defnition in class  why do we use public infront of a main function   Hi friend, The main method is similar to the main function in C and C++; it's the entry point for your application
c programming language - Java Beginners
c programming language  int main() { int i = 1, c = 0, sum = 1,j ; scanf("%d", &j); while (i <= j) { sum = sum + (i /3+i/5); printf("%d
C++ programming language - Java Beginners
C++ programming language  int main() { int i = 1, c = 0, sum = 1,j ; scanf("%d", &j); while (i <= j) { sum = sum + (i /3+i/5); printf
C file fsetpos() function
C file fsetpos() function This section demonstrates the use of fsetpos() function in C. The function fsetpos() is used to set the position of the stream... from the function fgetpos(). Its syntax is: fsetpos(File *stream,const fpos_t
C Language
C Language  Respected sir, Why does sizeof report a larger size than I expect for a structure type, as if there were padding at the end? help me sir
C Language
C Language  Respected Sir, How can I determine the byte offset of a field within a structure? How can I access structure fields by name at run time? please help me sir . Thank you sir
C file fseek() function
C file fseek() function This section demonstrates the use of fseek() function in C. This function sets the file position indicator for the stream pointed... with an example. In the following code, the function fopen(file, "w"
java & c
java & c  why c language is called top down approach? why java is called bottom to top approach?   In C, compilation stats from the very... the main function; thereafter as the control comes across these data types
C++Tutorials
++ is a programming language substantially different from C. Many see C++ as "a better C than... to teach C++ in a way that makes use of what the language can offer. C++ shares... to speed on that language.      C++ Annotations
Main function.. - Java Beginners
Main function..  Hi Friend.. public static void main(String args[]) What does it mean...public - static - void - main -(String args[]) Can u plz... return the value when it exits main(): This is the entry point for the application
C and C++ books-page3
a prototype language called ``C With Classes.'' In C++, one uses classes...; The C Language Tutorial This section contains a brief introduction to the C language. It is intended as a tutorial on the language, and aims
What is Public static void main
What is Public static void main In most of the Programming language, main function is the first function where program start execution. This is the first... are the variation of main method. public static void main(String[] args) public
c language code
c language code  Dear Sir, Could you send me the c language codings for BOOK BANK
c-language pointer functions
c-language pointer functions  what is the execution process of character pointer functions with example
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
c question
c question  How to convert decimal numbers into binary digits without using pow function in c language
about a program in c language
about a program in c language   Write a program that inputs five different integers from the keyboard, then print the sum, the product, the smallest and the largest of these numbers. Use only single selection form of if statement
Write a C language program to read two matrices and multiply them?
Write a C language program to read two matrices and multiply them?  Write a C language program to read two matrices and multiply them?   Here is an example of multiplying two matrices using C language. #include <
C file fgetpos() function
C file fgetpos() function This section demonstrates you the use of fgetpos() function. This function get the current read/write position of stream and stores...() function to return to the same position. Its syntax is: fgetpos(File *stream
C/C++/JAVA Question on function
C/C++/JAVA Question on function  "Write a function to find out common... other data type also.ΓΆβ?¬Β? Question can be solved in C,C++ or JAVA. (Recommneded - C
logic for c language
logic for c language  01 02 03 04 05 06 20 21 22 23 24 07 19 32 33 34 25 08 18 31 36 35 26 09 17 30 29 28 27 10 16 15 14 13 12 11
example of function overriding in c++
example of function overriding in c++  require an example of function overriding in c
Change case in C language
Change case in C language  I want to right in .dat file through structure.For this i have defined following: struct student //structure defination... If user is typing b5678 ,i want to store as B5678. (C)for input i am using
Sample code for An ASCII Encryption and Decryption code in C-language only.
Sample code for An ASCII Encryption and Decryption code in C-language only... in ASCII format and only in C (NOT EVEN C++). Thank you.Please if possible post answers also to   #include<stdio.h> void main(){ FILE *fp1,*fp2
Wrong parameter values while exporting data from jsp to excel
Wrong parameter values while exporting data from jsp to excel   This is a jsp report. When i export the report data to an excel, the parameter..., specifically, if the parameter value is ALL, it gets translated to NO in excel
hotel management programme in c language?
hotel management programme in c language?  hotel management programme in c language
Function pointer in c
Function pointer in c  What is the difference between function call with function pointer and without function pointer(normal function call
C and C++ books-page10
; The programming language C As a programming language, C is rather... offers an introduction to the C++ programming language. It is a guide for C/C... should realize that extensive knowledge of the C programming language is actually
main() method
main() method  Can we define two main() methods having same parameter but with different return type in a program
<c: out> in JSTL
tag is <c: out>. The main function of the this tag is to display the output...<c: out> in JSTL      ...; Attributes of the <c: out> core action tag.  value: It specify
main function in java - Java Interview Questions
main function in java  1....why is function main() define as static in java? 2...drawbacks of using rmi
Inverse of an array in C
Code: #include<stdio.h> #include<conio.h> void main...(a,6); getch(); } void read(int c[],int i) { int j; printf("...;%d",&c[j]); } void display(int d[],int i) { int j; printf
c++
c++  write a prgrm tht accepts 3 integer values,then with a function to swap the values
C Concepts
C Concepts  respected sir, Can I use a void ** pointer as a parameter so that a function can accept a generic pointer by reference? I have a function extern int f(int *); which accepts a pointer to an int. How can I pass
c++
c++  .write a program that accepts 5 subjects of a student,it should have a function to calculate the average & another function to grade.grade should be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70
c++
c++  .write a prgrm tht accepts 5 subjects of a student,it shld hv a function to calculate the average & another function to grade.grade shld be as follows-<40=E,40-49=D,50-59=C,60-69=B & >70
c++
c++  write a prgrm tht calculates the surface area of a cylinder.the prgrm shld find the circumfrance and have a function that calculates the fadius and another to calculate the surface area