Can You Explain The Usage Of The Following Liabrary Functions:1.fopen 2.fflush 3.fclose 4.fgets?
fopen 2.fflush 3.fclose 4.fgets
1 Answer - Sort by: Date | Rating
These are file functions.
fopen takes the name of a file and how to open it (read-only, append, etc). It returns a file handle.
fclose closes a file handle.
fflush pushes buffered data to the file. This can be important if your OS delays writes to files for performance reasons.
fgets reads a line from a file handle.
For example, you might do this (in PHP):
$fh = fopen('myfile.txt','r');
$line = fgets($fh);
fclose($fh);
Error-checking is left as an exercise for the reader!
You don't need to use fflush unless you are writing to the file handle (with fputs for example).
fopen takes the name of a file and how to open it (read-only, append, etc). It returns a file handle.
fclose closes a file handle.
fflush pushes buffered data to the file. This can be important if your OS delays writes to files for performance reasons.
fgets reads a line from a file handle.
For example, you might do this (in PHP):
$fh = fopen('myfile.txt','r');
$line = fgets($fh);
fclose($fh);
Error-checking is left as an exercise for the reader!
You don't need to use fflush unless you are writing to the file handle (with fputs for example).
1
0
- What Programming Language Do Most Websites Use?
- Discuss The Challenges Of Data Base Management Today?
- When Does Overloading Occurs?
- Describe The Problems With Two-tier Client-server Dbms Architecture?
- What Is Object-Orientation Approach In Information Systems?
- What Are The Functions In Visual Basic?
- What Is Pass By Value In Visual Basic?
- EXPLAIN THE Pass By Value & Pass By Reference In Visual Basic?
- What Is A Declarative Programming Language?
- In Windows Based Programming,what Do You Mean By Controls,properties Of Control,events And Methods?
- How To Enable LAN When Not Active Or Functioning?
- Without Using Arithmetic Operator How To Add Two Values In Php?
- How To Make Your Phone Java Supported?
- Write Down The Complete Html Code To Generate A Web Page In The Following Format As Shown Below?
- What Is The Difference Between Two Tier And Three Tier Client/server Architecture?
- Describe The Problem With Two- Tier Server Dbms Architecture?
- What Is The Difference Between Two-tier And Three Tier Client Server Architecture?
- How To Make A Simple Programming?
- What Is A Structured Form?
- Compile A 1000 To1250 Word Survival Guide That Serves As A Resource Throughout Your Program?
- How Many Numbers Between 1 And 1000 Have An Odd Quantity Of Divisors?
- What Are The Service In Rmi?
- How To Do Loop Stitch For Attaching Palette's?
- Generate An Object-oriented Design For A System That Keeps Tracks Of Your CD And DVD Collection?
- What Is Local Procedural Call?
- Can Anyone Explain The Usage Of 'Either'?
- Can You Explain The Usage And Step Of Literature Survey?
- Can You Explain The Functions Of Capital:
- Explain The Functions Of An Entrepreneur.
- Can Anyone Explain Different Functions Of Auditing?
- Can You Explain The Functions Of The Market?
- Can Anyone Explain The Different Functions Of A Trade Union?
- Can You Explain The Cytoskeleton Functions And Structure?
- Can You Explain The Company Promoters And Their Functions?
- Can Anyone Explain Different Functions Of Internal Audit?
- Can Anyone Explain Different Functions Of Cost Accounting?
- What Is Cell Membrane? Explain Along With Is Functions.

New Comment - Comments are editable for 5 min.