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 Tutorials/Questions & Answers:
Main function parameter in C language - AjaxMain 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 - AjaxC 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 Advertisements
C LanguageC Language What's the right declaration for
main()?
Is void
main() correct?
in
C language ?
please help me sir !
Thank You
bsearch() function in Cbsearch()
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
main functionmain function Give me the description of public static void
main(Strings args
C Pointer to a function;
function in
C.
C provides a special feature of pointer to a
function. As you know that every
function defined in
C language have a
base address...
C Pointer to a
function
C languageC 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 LanguageC 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 LanguageC 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
Main function.. - Java BeginnersMain 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 language codec language code Dear Sir, Could you send me the
c language codings for BOOK BANK
C/C++/JAVA Question on functionC/
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 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
Function pointer in cFunction pointer in c What is the difference between
function call with
function pointer and without
function pointer(normal
function call
C Language - Java BeginnersC 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
function overloading in cfunction overloading in c are
int func1(int x, int y)
and
void func1(int x, int y) overloaded?
can the functions with same name same arguments but different return types be overloaded
logic for c languagelogic 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
C file fsetpos() functionC 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
Change case in C languageChange 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
C file fseek() functionC 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"
What is Public static void mainWhat 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: out> in JSTL library tag is <
c:
out>. The
main function of the this tag is to display...<
c: out> in JSTL
...;.
Attributes of the <
c: out> core action tag.
value
C Language - Design concepts & design patternsC Language What is meant by %u in printf statement in
c?
for example,%d means integer value,like that what is %u? Hi Friend,
%u is used to print an unsigned integer.
Unsigned integers are non-negative numbers
<c: out> attribute default core library tag is <
c:
out>. The
main function of the this tag...<
c: out> attribute default
...;.
Attributes of the <
c: out> core action tag.
value
C file fgetpos() functionC 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: out> attribute escapeXml library tag is <
c:
out>. The
main function of the this tag is to display...<
c: out> attribute escapeXml
...;.
Attributes of the <
c: out> core action tag.
value: It specify
<c: out> For Simple Calculation and Output purpose core library tag is <
c:
out>. The
main function of the this tag...<
c: out> For Simple Calculation and Output
...;.
Attributes of the <
c: out> core action tag.
value
c questionc question How to convert decimal numbers into binary digits without using pow
function in
c language Ask C/C++ Questions online language, but both the languages are popular among programmers.
C is a general purpose programming
language that can run on most of the platforms.
C is used... Bell Laboratory while
C++ is a popular object oriented programming
language c++c++ write a prgrm tht accepts 3 integer values,then with a
function to swap the values