Subaru Impreza STi 2002 Service Manual
Including
General information
Engine 2 Section
Transmission Section
Chassis Section
Body Section
Wiring Section
And now you can do your inspection / service by you own
Enjoy
This is the Highly Detailed factory service repair manual for the2007 NISSAN PATHFINDER, this Service Manual has detailed illustrations as well as step by step instructions,It is 100 percents complete and intact. they are specifically written for the do-it-yourself-er as well as the experienced mechanic.2007 NISSAN PATHFINDER Service Repair Workshop Manual provides step-by-step instructions based on the complete dis-assembly of the machine. It is this level of detail, along with hundreds of photos and illustrations, that guide the reader through each service and repair procedure. Complete download comes in pdf format which can work under all PC based windows operating system and Mac also, All pages are printable. Using this repair manual is an inexpensive way to keep your vehicle working properly.
Service Repair Manual Covers:
* General Information
* Engine Mechanical
* Engine Lubrication System
* Engine Cooling System
* Engine Control System
* Fuel System
* Exhaust System
* Accelerator Control System
* Automatic Transmission
* Transfer
* Propeller Shaft
* Front Final Drive
* Rear Final Drive
* Front Axle
* Rear Axle
* Front Suspension
* Rear Suspension
* Road Wheels & Tires
* Brake System
* Parking Brake System
* Brake Control System
* Power Steering System
* Seat Belts
* Supplemental Restraint System (SRS)
* Body, Lock & Security System
* Glasses, Window System & Mirrors
* Roof
* Exterior & Interior
* Instrument Panel
* Seat
* Adjustable Pedal
* Automatic Air Conditioner
* Manual Air Conditioner
* Starting & Charging System
* Lighting System
* Driver Information System
* Wiper, Washer & Horn
* Body Control System
* LAN System
* Audio Visual, Navigation & Telephone System
* Auto Cruise Control System
* Power Supply, Ground & Circuit Elements
* Maintenance
* Alphabetical Index
File Format: PDF
Compatible: All Versions of Windows & Mac
Language: English
Requirements: Adobe PDF Reader
NO waiting, Buy from responsible seller and get INSTANT DOWNLOAD, Without wasting your hard-owned money on uncertainty or surprise! All pages are is great to have2007 NISSAN PATHFINDER Service Repair Workshop Manual.
Looking for some other Service Repair Manual,please check:
https://www.aservicemanualpdf.com/
Thanks for visiting!
Subaru Impreza STi 2002 Service Manual
Including
General information
Engine 2 Section
Transmission Section
Chassis Section
Body Section
Wiring Section
And now you can do your inspection / service by you own
Enjoy
This is the Highly Detailed factory service repair manual for the2007 NISSAN PATHFINDER, this Service Manual has detailed illustrations as well as step by step instructions,It is 100 percents complete and intact. they are specifically written for the do-it-yourself-er as well as the experienced mechanic.2007 NISSAN PATHFINDER Service Repair Workshop Manual provides step-by-step instructions based on the complete dis-assembly of the machine. It is this level of detail, along with hundreds of photos and illustrations, that guide the reader through each service and repair procedure. Complete download comes in pdf format which can work under all PC based windows operating system and Mac also, All pages are printable. Using this repair manual is an inexpensive way to keep your vehicle working properly.
Service Repair Manual Covers:
* General Information
* Engine Mechanical
* Engine Lubrication System
* Engine Cooling System
* Engine Control System
* Fuel System
* Exhaust System
* Accelerator Control System
* Automatic Transmission
* Transfer
* Propeller Shaft
* Front Final Drive
* Rear Final Drive
* Front Axle
* Rear Axle
* Front Suspension
* Rear Suspension
* Road Wheels & Tires
* Brake System
* Parking Brake System
* Brake Control System
* Power Steering System
* Seat Belts
* Supplemental Restraint System (SRS)
* Body, Lock & Security System
* Glasses, Window System & Mirrors
* Roof
* Exterior & Interior
* Instrument Panel
* Seat
* Adjustable Pedal
* Automatic Air Conditioner
* Manual Air Conditioner
* Starting & Charging System
* Lighting System
* Driver Information System
* Wiper, Washer & Horn
* Body Control System
* LAN System
* Audio Visual, Navigation & Telephone System
* Auto Cruise Control System
* Power Supply, Ground & Circuit Elements
* Maintenance
* Alphabetical Index
File Format: PDF
Compatible: All Versions of Windows & Mac
Language: English
Requirements: Adobe PDF Reader
NO waiting, Buy from responsible seller and get INSTANT DOWNLOAD, Without wasting your hard-owned money on uncertainty or surprise! All pages are is great to have2007 NISSAN PATHFINDER Service Repair Workshop Manual.
Looking for some other Service Repair Manual,please check:
https://www.aservicemanualpdf.com/
Thanks for visiting!
The best time to evaluate an organization is when you are interviewing them. By using this training vendor scorecard in real-time, your unfiltered opinions will bubble to the top, providing the most authentic evaluation possible.
By creating a scorecard, you can easily compare the responses that the various companies provided and you can create your own “scoring” of each answer to help you reach a numerical winner. The scorecard is a good exercise, but it should not supersede how you feel about the organization. You are selecting a company to have a relationship with. You want to feel like you’ve selected a company you are proud to be associated. You want a company that is trustworthy. That’s why, even if one company outscores the others in every category, the ranking they earn as trustworthy should supersede everything else.
Embedded Recipes 2018 - swupdate: update your embedded device - Charles-Anto...Anne Nicolas
Nowadays a lot of embedded system are connected to Internet. And every years, more devices are available in the market but without maintenance. Due to this situation, a lot of security issues raised which could compromised the lifetime of the product and the privacy of their users. To fix these bugs, these security issues or to add new features, updating remotely these systems on regular basis is very important. We have to think about update process for each new product, to be easy, reliable, efficient and not too costly for the required bandwidth or hardware performances.
Several update designs are available to fit your requirements. Due to these constraints, you have to make choice and find the right balance.
Hopefully one free software allows us to perform this task in a easy and flexible way: swupdate. This solution is very well integrated with U-boot, buildroot and Yocto. You can describe exactly how the update should be done.
This talk is to explain the main designs to update an embedded system with pro and cons of all of them and then explain how to implement them with swupdate for your embedded system.
X-prog M ECU programmer V5.50 users manualbuyobdii
The XPROG-m supports in-circuit and on-board programming of Motorola 68HC05, 68HC08, 68HC11, 68HC(S)12 family MCU's, Texas Instruments TMS370/TMS374 family MCU's and serial EEPROM's .
All supported devices are divided into "Software authorization" licenses. You can obtain authorization license only for these devices you are interested in.
http://www.eobd2.fr/new-xprog-m-v50-xprog-m-programmer-v50-204.html
The best time to evaluate an organization is when you are interviewing them. By using this training vendor scorecard in real-time, your unfiltered opinions will bubble to the top, providing the most authentic evaluation possible.
By creating a scorecard, you can easily compare the responses that the various companies provided and you can create your own “scoring” of each answer to help you reach a numerical winner. The scorecard is a good exercise, but it should not supersede how you feel about the organization. You are selecting a company to have a relationship with. You want to feel like you’ve selected a company you are proud to be associated. You want a company that is trustworthy. That’s why, even if one company outscores the others in every category, the ranking they earn as trustworthy should supersede everything else.
Embedded Recipes 2018 - swupdate: update your embedded device - Charles-Anto...Anne Nicolas
Nowadays a lot of embedded system are connected to Internet. And every years, more devices are available in the market but without maintenance. Due to this situation, a lot of security issues raised which could compromised the lifetime of the product and the privacy of their users. To fix these bugs, these security issues or to add new features, updating remotely these systems on regular basis is very important. We have to think about update process for each new product, to be easy, reliable, efficient and not too costly for the required bandwidth or hardware performances.
Several update designs are available to fit your requirements. Due to these constraints, you have to make choice and find the right balance.
Hopefully one free software allows us to perform this task in a easy and flexible way: swupdate. This solution is very well integrated with U-boot, buildroot and Yocto. You can describe exactly how the update should be done.
This talk is to explain the main designs to update an embedded system with pro and cons of all of them and then explain how to implement them with swupdate for your embedded system.
X-prog M ECU programmer V5.50 users manualbuyobdii
The XPROG-m supports in-circuit and on-board programming of Motorola 68HC05, 68HC08, 68HC11, 68HC(S)12 family MCU's, Texas Instruments TMS370/TMS374 family MCU's and serial EEPROM's .
All supported devices are divided into "Software authorization" licenses. You can obtain authorization license only for these devices you are interested in.
http://www.eobd2.fr/new-xprog-m-v50-xprog-m-programmer-v50-204.html
This presentation covers the various types of multimedia, the advantages and disadvantages of their use as well as how multimedia can be used in education.
File Operation such as
Reading the file content
Writing the content to the file
Copying the content from one file to another file
Counting the number of character, words and lines of the file
At the end of this lecture students should be able to;
Define the C standard functions for managing file input output.
Apply taught concepts for writing programs.
Similar to file handling, dynamic memory allocation (20)
This PPT is for First year engineering student,It covered all about C Programming according to Rajastha Technical University Kota.
flowchart, pseudo code, Programming Languages and Language Translators, Identifiers, Constants, Variables, Basic Data Types, Operators, Expressions, type casting, Input / Output Statement, Scope Rules and Storage classes, Preprocessor and Macro Substitution.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxR&R Consult
CFD analysis is incredibly effective at solving mysteries and improving the performance of complex systems!
Here's a great example: At a large natural gas-fired power plant, where they use waste heat to generate steam and energy, they were puzzled that their boiler wasn't producing as much steam as expected.
R&R and Tetra Engineering Group Inc. were asked to solve the issue with reduced steam production.
An inspection had shown that a significant amount of hot flue gas was bypassing the boiler tubes, where the heat was supposed to be transferred.
R&R Consult conducted a CFD analysis, which revealed that 6.3% of the flue gas was bypassing the boiler tubes without transferring heat. The analysis also showed that the flue gas was instead being directed along the sides of the boiler and between the modules that were supposed to capture the heat. This was the cause of the reduced performance.
Based on our results, Tetra Engineering installed covering plates to reduce the bypass flow. This improved the boiler's performance and increased electricity production.
It is always satisfying when we can help solve complex challenges like this. Do your systems also need a check-up or optimization? Give us a call!
Work done in cooperation with James Malloy and David Moelling from Tetra Engineering.
More examples of our work https://www.r-r-consult.dk/en/cases-en/
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
4. By- Er. Indrajeet Sinha , +919509010997
3.1.1 ARRAY OF STRUCTURES
Definition:
Structure is used to store the information of One particular
object but if we need to store such 100 objects then Array of
Structure is used.
Example :
struct Bookinfo
{
char[20] bname;
int pages;
int price;
}
Book[100];
4
1.Here Book structure is used to
Store the information of one Book.
2. In case if we need to store the
Information of 100 books then
Array of Structure is used.
3. b1[0] stores the Information of
1st Book , b1[1] stores the
information of 2nd Book and So on
We can store the information of 100
books.
5. By- Er. Indrajeet Sinha , +919509010997
3.1.2 POINTERS TO STRUCTURES
Pointer to Structure in C Programming
Address of Pointer variable can be obtained using ‘&’operator.
Address of such Structure can be assigned to the Pointer
variable .
Pointer Variable which stores the address of Structure must
be declared as Pointer to Structure .
Pointer to Structure Syntax :
struct student_database
{
char name[10];
int roll;
int marks;
}stud1;
struct student_database *ptr;
ptr = &stud1; How to Access Structure Members?
5
6. By- Er. Indrajeet Sinha , +919509010997
Simple program without Pointer variable:
#include <stdio.h>
int main()
{
struct student database
{
char name[10];
int roll; int marks;
}stud1;
stud1.roll = 10;
stud1.marks = 90;
printf("Roll Number : %d",stud1.roll);
printf("Marks of Student : %d",stud1.marks);
return 0;
}
6
Output:
Roll Number : 10
Marks of Student : 90
7. By- Er. Indrajeet Sinha , +919509010997
Simple program with Pointer variable:
#include <stdio.h>
int main(int argc, char *argv[])
{
struct student_database
{
char name[10];
int roll;
int marks;
}stud1 = {"Pritesh",90,90};
struct student_database *ptr;
ptr = &stud1;
printf("Roll Number : %d",(*ptr).roll);
printf("Marks of Student : %d",(*ptr).marks);
return 0;
}
7
Output:
Roll Number : 90
Marks of Student : 90
8. By- Er. Indrajeet Sinha , +919509010997
3.1.3 ARRAY OF POINTERS
Array of pointers
8
10. By- Er. Indrajeet Sinha , +919509010997
3.2.1 INTRODUCTION OF FILE
HANDLING
Drawbacks of Traditional I/O System.
1. Until now we are using Console Oriented I/O functions.
“Console Application” means an application that has a text-
based interface. (black screen window))
2. Most applications require a large amount of data , if this
data is entered through console then it will be quite
time consuming task.
3. Main drawback of using Traditional I/O :- data is
temporary (and will not be available during re-execution )
10
11. By- Er. Indrajeet Sinha , +919509010997
File handling in C :
1. New way of dealing with data is file handling.
2. Data is stored onto the disk and can be retrieve whenever
require.
3. Output of the program may be stored onto the disk
4. In C we have many functions that deals with file handling
5. A file is a collection of bytes stored on a secondary
storagedevice (generally a disk)
Collection of byte may be interpreted as –
Single character
Single Word
Single Line
Complete Structure.
11
13. By- Er. Indrajeet Sinha , +919509010997
3.2.2 OPENING & CLOSING FILE
Opening Files
We can use the fopen( ) function to create a new file or to
open an existing file. This call will initialize an object of the
type FILE, which contains all the information necessary to
control the stream. The prototype of this function call is as
follows −
FILE *fopen( const char * filename, const char * mode );
Note:- Here, filename is a string literal, which will use to
name of our file, and access mode can have any one.
13
14. By- Er. Indrajeet Sinha , +919509010997
Mode Description
r Opens an existing text file for reading purpose.
w Opens a text file for writing. If it does not exist, then a new file
is created. Here your program will start writing content from
the beginning of the file.
a Opens a text file for writing in appending mode. If it does not
exist, then a new file is created. Here your program will start
appending content in the existing file content.
r+ Opens a text file for both reading and writing.
w+ Opens a text file for both reading and writing. It first truncates
the file to zero length if it exists, otherwise creates a file if it
does not exist.
a+ Opens a text file for both reading and writing. It creates the
file if it does not exist. The reading will start from the
beginning but writing can only be appended. 14
15. By- Er. Indrajeet Sinha , +919509010997
If you are going to handle binary files, then we will use
following access modes instead of the above mentioned
ones
15
Mode Description
rb Opens an existing text file for reading purpose.
wb Opens a text file for writing. If it does not exist, then a new file is
created. Here your program will start writing content from the
beginning of the file.
ab Opens a text file for writing in appending mode. If it does not exist,
then a new file is created. Here your program will start appending
content in the existing file content.
r+b Opens a text file for both reading and writing.
w+b Opens a text file for both reading and writing. It first truncates the file
to zero length if it exists, otherwise creates a file if it does not exist.
a+b Opens a text file for both reading and writing. It creates the file if it
does not exist. The reading will start from the beginning but writing
can only be appended.
16. By- Er. Indrajeet Sinha , +919509010997
Closing file
To close a file, use the fclose( ) function. The prototype of
this function is −
int fclose( FILE *fp );
The fclose(-) function returns zero on success, or EOF if
there is an error in closing the file. This function actually
flushes any data still pending in the buffer to the file,
closes the file, and releases any memory used for the file.
The EOF is a constant defined in the header file stdio.h.
16
17. By- Er. Indrajeet Sinha , +919509010997
Writing a File
Following is the simplest function to write individual
characters to a stream −
int fputc( int c, FILE *fp );
The function fputc() writes the character value of the
argument c to the output stream referenced by fp. It
returns the written character written on success
otherwise EOF if there is an error. You can use the
following functions to write a null-terminated string to a
stream −
int fputs( const char *s, FILE *fp );
The function fputs() writes the string s to the output
stream referenced by fp. It returns a non-negative value on
success, otherwise EOF is returned in case of any error.
17
18. By- Er. Indrajeet Sinha , +919509010997
CONT..
#include <stdio.h>
main()
{
FILE *fp; fp = fopen("/tmp/test.txt", "w+");
fprintf(fp, "This is testing for fprintf...n");
fputs("This is testing for fputs...n", fp);
fclose(fp);
}
When the above code is compiled and executed, it creates a
new file test.txt in /tmp directory and writes two lines
using two different functions. 18
19. By- Er. Indrajeet Sinha , +919509010997
CONT..
Reading a File
Given below is the simplest function to read a single
character from a file −
int fgetc( FILE * fp );
The fgetc() function reads a character from the input file
referenced by fp. The return value is the character read, or
in case of any error, it returns EOF. The following function
allows to read a string from a stream −
char *fgets( char *buf, int n, FILE *fp );
The functions fgets() reads up to n-1 characters from the
input stream referenced by fp. It copies the read string into
the buffer buf, appending a null character to terminate
the string.
19
20. By- Er. Indrajeet Sinha , +919509010997
CONT..
If this function encounters a newline character 'n' or the
end of the file EOF before they have read the maximum
number of characters, then it returns only the characters
read up to that point including the new line character. You
can also use int fscanf(FILE *fp, const char
*format, ...) function to read strings from a file, but it stops
reading after encountering the first space character.
20
21. By- Er. Indrajeet Sinha , +919509010997
CONT..
main()
{
FILE *fp;
char buff[255];
fp = fopen("/tmp/test.txt", "r");
fscanf(fp, "%s", buff); printf("1 : %sn", buff );
fgets(buff, 255, (FILE*)fp); printf("2: %sn", buff );
fgets(buff, 255, (FILE*)fp); printf("3: %sn", buff );
fclose(fp);
}
Note: First, fscanf() read just This because after that, it
encountered a space, second call is for fgets() which reads the
remaining line till it encountered end of line. Finally, the last
call fgets() reads the second line completely.
21
Output:-
1 : This
2: is testing for fprintf...
3: This is testing for fputs...
22. By- Er. Indrajeet Sinha , +919509010997
3.2.3 BINARY & TEXT FILES
Definition
Text File:-A text file is a file that is properly understood
as a sequence of character data, separated into lines. when
a text file is displayed as a sequence of characters, it is
easily human-readable.
Binary File:- A binary file is anything else. A binary file
will include some data that is not written using a
character-encoding standard some number would be
represented using binary within the file, instead of using
the character representation of its various digits
22
24. By- Er. Indrajeet Sinha , +919509010997
3.2.4 FPRINTF(), FSCANF(), FEOF()
C library function - fprintf()
Description
The C library function int fprintf(FILE *stream, const char
*format, ...) sends formatted output to a stream.
Declaration
int fprintf(FILE *stream, const char *format, ...)
Parameters
stream − This is the pointer to a FILE object that identifies the
stream.
format − This is the C string that contains the text to be written
to the stream. It can optionally contain embedded format tags
that are replaced by the values specified in subsequent
additional arguments and formatted as requested. Format tags
prototype is %[flags][width][.precision][length]specifier,
which is explained in next slide.
24
25. By- Er. Indrajeet Sinha , +919509010997
specifier Output
c Character
d or i Signed decimal integer
e Scientific notation (mantissa/exponent) using e
character
E Scientific notation (mantissa/exponent) using E
character
f Decimal floating point
g Uses the shorter of %e or %f
G Uses the shorter of %E or %f
25
26. By- Er. Indrajeet Sinha , +919509010997
CONT..
o Signed octal
s String of characters
u Unsigned decimal integer
x Unsigned hexadecimal integer
X Unsigned hexadecimal integer (capital letters)
p Pointer address
n Nothing printed
% Character
26
27. By- Er. Indrajeet Sinha , +919509010997
Example:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE * fp; fp = fopen ("file.txt", "w+");
fprintf(fp, "%s %s %s %d", "We", "are", "in", 2012);
fclose(fp);
return(0);
}
Let us compile and run the above program that will create a
file file.txt with the following content −
We are in 2012
27
28. By- Er. Indrajeet Sinha , +919509010997
C library function - fscanf(),
Description
The C library function int fscanf(FILE *stream, const
char *format, ...) reads formatted input from a stream.
Declaration
Following is the declaration for fscanf() function.
int fscanf(FILE *stream, const char *format, ...)
Parameters
stream − This is the pointer to a FILE object that identifies the
stream.
format − This is the C string that contains one or more of the
following items − Whitespace character, Non-whitespace
character and Format specifiers. A format specifier will be
as [=%[*][width][modifiers]type=], which is explained in
next slide.
28
29. By- Er. Indrajeet Sinha , +919509010997
Argument Description
* This is an optional starting asterisk indicates that the
data is to be read from the stream but ignored, i.e. it is
not stored in the corresponding argument.
width This specifies the maximum number of characters to be
read in the current reading operation.
modifiers Specifies a size different from int (in the case of d, i and
n), unsigned int (in the case of o, u and x) or float (in the
case of e, f and g) for the data pointed by the
corresponding additional argument: h : short int (for d, i
and n), or unsigned short int (for o, u and x) l : long int
(for d, i and n), or unsigned long int (for o, u and x), or
double (for e, f and g) L : long double (for e, f and g)
type A character specifying the type of data to be read and
how it is expected to be read. See next table. 29
31. By- Er. Indrajeet Sinha , +919509010997
C LIBRARY FUNCTION - FEOF()
Description
The C library function int feof(FILE *stream) tests the end-
of-file indicator for the given stream.
Declaration
Following is the declaration for feof() function.
int feof(FILE *stream)Parameters
stream − This is the pointer to a FILE object that identifies
the stream.
Return Value
This function returns a non-zero value when End-of-File
indicator associated with the stream is set, else zero is
returned.
31
32. By- Er. Indrajeet Sinha , +919509010997
EXAMPLE:
#include <stdio.h>
int main ()
{
FILE *fp; int c; fp = fopen("file.txt","r");
if(fp == NULL)
{
perror("Error in opening file");
return(-1);
} while(1)
{ c = fgetc(fp);
if( feof(fp) )
{ break ;
}
printf("%c", c);
} fclose(fp);
return(0);
}
32
NOTE:Assuming we have a text file file.txt,
which has the following content. This file will be
used as an input for our example program −
This is indrajeet
Output:
This is indrajeet
34. By- Er. Indrajeet Sinha , +919509010997
3.2.6 FREAD(), FWRITE()
C library function - fread()
Description
The C library function size_t fread(void *ptr, size_t size,
size_t nmemb, FILE *stream) reads data from the
given stream into the array pointed to, by ptr.
Declaration
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
Parameters
ptr − This is the pointer to a block of memory with a minimum size
of size*nmemb bytes.
size − This is the size in bytes of each element to be read.
nmemb − This is the number of elements, each one with a size
of size bytes.
stream − This is the pointer to a FILE object that specifies an input
stream.
34
35. By- Er. Indrajeet Sinha , +919509010997
Example
#include <stdio.h>
#include <string.h>
int main()
{
FILE *fp; char c[] = "this is Indrajeet";
char buffer[100]; /* Open file for both reading and writing */
fp = fopen("file.txt", "w+"); /* Write data to the file */
fwrite(c, strlen(c) + 1, 1, fp); /* Seek to the beginning of the file */
fseek(fp, SEEK_SET, 0); /* Read and display data */
fread(buffer, strlen(c)+1, 1, fp);
printf("%sn", buffer);
fclose(fp);
return(0);
}
Output:- this is Indrajeet
35
36. By- Er. Indrajeet Sinha , +919509010997
C library function - fwrite()
Description
The C library function size_t fwrite(const void *ptr, size_t size,
size_t nmemb, FILE *stream) writes data from the array pointed
to, by ptr to the given stream.
Declaration
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
Parameters
ptr − This is the pointer to the array of elements to be written.
size − This is the size in bytes of each element to be written.
nmemb − This is the number of elements, each one with a size
of size bytes.
stream − This is the pointer to a FILE object that specifies an output
stream.
36
37. By- Er. Indrajeet Sinha , +919509010997
#include<stdio.h>
int main ()
{
FILE *fp; char str[] = "This is Arya First year Department";
fp = fopen( "file.txt" , "w" );
fwrite(str , 1 , sizeof(str) , fp );
fclose(fp);
return(0);
}
Note:- Let us compile and run the above program that will
create a file file.txt which will have following content −
This is Arya First year Department 37
38. By- Er. Indrajeet Sinha , +919509010997
Now let's see the content of the above file using the following
program
#include <stdio.h>
int main ()
{
FILE *fp; int c; fp = fopen("file.txt","r");
while(1)
{
c = fgetc(fp);
if( feof(fp) )
{
break ;
}
printf("%c", c);
}
fclose(fp);
return(0);
38
Output:
This is Arya First year
Department
39. By- Er. Indrajeet Sinha , +919509010997
3.2.8 SEQUENTIAL VS. RANDOM
ACCESS FILES
In computer programming, the two main types of file handling
are:
Sequential;
Random access.
Definition:
Sequential files are generally used in cases where the
program processes the data in a sequential fashion – i.e.
counting words in a text file – although in some cases, random
access can be feigned by moving backwards and forwards over a
sequential file.
True random access file handling, however, only accesses the
file at the point at which the data should be read or written,
rather than having to process it sequentially. A hybrid
approach is also possible whereby a part of the file is used for
sequential access to locate something in the random access
portion of the file, in much the same way that a File Allocation
Table (FAT) works.
39
42. By- Er. Indrajeet Sinha , +919509010997
3.3.1 DYNAMIC MEMORY
ALLOCATION
C dynamic memory allocation refers to performing manual
memory management for dynamic memory allocation in the C
programming language via a group of functions in the C
standard library, namely malloc, realloc, calloc and free.
3.3.1.1 Malloc
Description
The C library function void *malloc(size_t size) allocates the
requested memory and returns a pointer to it.
Declaration
void *malloc(size_t size)
Parameters
size -- This is the size of the memory block, in bytes.
42
44. By- Er. Indrajeet Sinha , +919509010997
Definition:
When calloc is used to allocate a block of memory, the
allocated region is initialized to zeroes.
In contrast, malloc does not
touch the contents of the allocated block of memory, which
means it contains garbage values.
Description
The C library function void *calloc(size_t nitems, size_t
size)allocates the requested memory and returns a pointer to it.
The difference in malloc and calloc is that malloc does not set the
memory to zero where as calloc sets allocated memory to zero.
Declaration
void *calloc(size_t nitems, size_t size)
Parameters
nitems -- This is the number of elements to be allocated.
size -- This is the size of elements.
44
45. By- Er. Indrajeet Sinha , +919509010997
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i, n; int *a;
printf("Number of elements to be entered:");
scanf("%d",&n);
a = (int*)calloc(n, sizeof(int));
printf("Enter %d numbers:n",n);
for( i=0 ; i < n ; i++ )
{
scanf("%d",&a[i]);
}
printf("The numbers entered are: ");
for( i=0 ; i < n ; i++ )
{
printf("%d ",a[i]);
} free( a );
return(0);
}
45
Output:
Number of elements to be
entered:3
Enter 3 numbers:
22
55
14
The numbers entered are: 22 55 14
46. By- Er. Indrajeet Sinha , +919509010997
3.3.1.3 FREE
Description
The C library function void free(void *ptr) deallocates the
memory previously allocated by a call to calloc, malloc, or
realloc.
Declaration
void free(void *ptr)
Parameters
ptr -- This is the pointer to a memory block previously
allocated with malloc, calloc or realloc to be deallocated. If a
null pointer is passed as argument, no action occurs.
Return Value
This function does not return any value.
46
48. By- Er. Indrajeet Sinha , +919509010997
3.3.1.4 REALLOC
Description
The C library function void *realloc(void *ptr, size_t
size)attempts to resize the memory block pointed to
by ptr that was previously allocated with a call
to malloc or calloc.
Declaration
void *realloc(void *ptr, size_t size)
Parameters
ptr -- This is the pointer to a memory block previously allocated
with malloc, calloc or realloc to be reallocated. If this is
NULL, a new block is allocated and a pointer to it is returned
by the function.
size -- This is the new size for the memory block, in bytes. If it
is 0 and ptr points to an existing block of memory, the
memory block pointed by ptr is deallocated and a NULL
pointer is returned.
48
49. By- Er. Indrajeet Sinha , +919509010997
Return Value
This function returns a pointer to the newly allocated memory, or
NULL if the request fails.
Example
#include <stdio.h>
#include <stdlib.h>
int main() {
char *str; /* Initial memory allocation */
str = (char *)
malloc(15);
strcpy(str, “Indrajeet Sinha");
printf("String = %s, Address = %un", str, str); /* Reallocating memory */
str = (char *)
realloc(str, 25);
strcat(str, ".com");
printf("String = %s, Address = %un", str, str);
free(str); return(0); }
49
Output:
String = Indrajeet sinha, Address =
355090448 String = Indrajeet sinha,
Address = 355090448