This document discusses various functions used for file handling in C programming. It defines a file and describes basic file operations like opening, closing, reading, and writing to files. It then explains functions like fopen(), fclose(), fprintf(), fscanf(), fgetc(), fputc(), putw(), getw(), fseek(), and ftell() that are used to perform these basic file operations. Examples are provided to demonstrate the usage of each function.
Contents:-
Introduction
What is a File?
High Level I/O Functions
Defining & Opening a File
Closing a File
The getc and putc Functions
The getw and putw Functions
The fprintf and fscanf Functions
Contents:-
Introduction
What is a File?
High Level I/O Functions
Defining & Opening a File
Closing a File
The getc and putc Functions
The getw and putw Functions
The fprintf and fscanf Functions
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
4. What is file?
A file is a space on the disk where a group of related data is
stored.
Operations on a file
DEFINING A FILE
OPENING A FILE
CLOSING A FILE
WRITING DATA TO FILE
READING DATA FROM A FILE
5. Functions that helps to perform basic file operations.
fopen( ) - create a new file or open a existing file
fclose( ) - closes a file
fprintf( ) - writes a set of data to a file
fscanf( ) - reads a set of data from a file
fgetc( ) - reads a character from a file
fputc( ) - writes a character to a file
getw( ) - reads a integer from a file
putw( ) - writes a integer to a file
fseek( ) - set the position to desire point
ftell( ) - gives current position in the file
6. Defining a File
A file is identified by its name. This name is divided into two parts
File Name
It consists of alphabets and digits.
Special characters are also supported, but it depends on the operating
system we use.
Extension
It describes the file type
7. Opening a File
If we want to store data in file in secondary memory then ,
following things are needed:
*Filename: string of characters to make valid name for o/s.
*Data structure : for a file it is defined as a FILE in <stdio.h>
*Purpose: what to do ; like reading ,writing , append
9. FILE *p1,*p2;
p1=fopen(“data” , “r”);
p2=fopen(“results” , “w”);
Other modes
• The existing file is opened to the
beginning for both reading and writing.
r+
• Same as w except both foe reading
and writing.
w+
• Same as a but both for reading and
writing.
a+
10. Closing a File
A file is closed when all operations on it have been completed.
It ensures that all the data related to file are cleared from the
buffer.
Example:
FILE *p1,*p2;
p1=fopen(“INPUT” , ”w”);
p2=fopen(“OUTPUT” , ”r”);
…………………
…………………
fclose(p1);
fclose(p2);
12. C library function - fprintf( )
Description:-
The C library function sends formatted output to a stream.
Declaration:-
int fprintf(FILE *stream, const char *format, ...)
Return Value:-
If successful, the total number of characters written is returned
otherwise, a negative number is returned.
13. #include <stdio.h>
#include <conio.h>
void main(){
FILE * fp;
int c;
fp = fopen ("file.txt", “a+");
fprintf(fp, "%s %s %s %d", "We", "are", "in", 2012);
fclose(fp);
fp = fopen("file.txt","r");
while(1){
c = fgetc(fp);
if( feof(fp) ) {
break;}
printf("%c", c);}
fclose(fp);
getch();
}
file.txt
created on
pc
Example using fprintf() function:-
14. C library function - fscanf( )
Description:-
The C library function reads formatted input from a stream.
Declaration:-
int fscanf(FILE *stream, const char *format, ...)
17. • fgetc() function is used to read a file line by
line.
• It is used in program as:-
ch=fgetc(fs);
• It returns the character that is read, which
is collected in the variable ‘ch’.
C library function - fgetc( )
18. C library function - fputc( )
• fgetc() is a function which writes
characters to a file.
• It is used in program as:-
fputc(ch,ft);
• With the help of both functions, we can copy contents
of one file to another.
19. Example using fgetc() & fputc() function:-
int main()
{
FILE *fs,*ft;
char ch;
fs=fopen(“PR1.C”,”r”);
if(fs==NULL)
{
printf(“Cannot open ssource file”);
exit(1);
}
ft=fopen(“PR2.C,”w”);
if(ft==NULL)
{
printf(“Cannot open the file”);
fclose(fs);
exit(2);
}
while(1)
{
ch=fgetc(fs);
if(ch==EOF)
break;
else
fputc(ch,ft);
}
fclose(fs);
fclose(ft);
return 0;
}
21. C library function - putw( )
putw() function in “C” programming is use to write
integer data on the file (text file) .
SYNTAX :-
int putw(integer , FILE*);
22. Example using putw() function:-
Void main()
{
FILE *fp;
fp = fopen(“file1.txt”, “w”);
putw(65,fp);
fclose(fp);
}
23. C library function - getw( )
getw() function in “C” programming language is use
to read the integer data from the file.
SYNTAX :-
int getw(FILE*);
26. Random Access of File
Functions Include:-
1. fseek() = to jump a particular location in a file
2. ftell() = current location in a file
27. Functions used in random access
fseek(): This function is used to move the pointer to a desired position within a
file.
Syntax:
fseek(FILE *stream, long int offset, int whence)
Stream − This is the pointer to a FILE object that identifies the stream.
Offset –This specifies the number of positions (bytes)to be moved from the
location specified by position.
Whence-This is the position from where offset is added. It is specified by
one of the following constants
Constant Description
SEEK_SET Beginning of file
SEEK_CUR Current position of the file pointer
SEEK_END End of file
28. #include <stdio.h> OUTPUT
void main (){
FILE *fp; ; = FILE OPEN IN WRITE MODE
int c,l
fp = fopen("file.txt",“w");
fputs("This is Deepika", fp);
fseek( fp, 7, SEEK_SET );
fputs(" C Programming Language", fp);
fclose(fp); =FILE OPEN IN READ MODE
fp = fopen("file.txt","r");
while(1)
{c = fgetc(fp);
if( feof(fp) ){
break;}
printf("%c", c);}
fp = fopen("file.txt", “a");
fseek(fp, 0, SEEK_END); =THE FILE SIZE IS 30BYTES
l = ftell(fp);
printf("nnnnTotal size of file.txt = %d bytes", l);
fprintf(fp,”nnnTotal size of the file=%d bytes”,l);
fclose(fp);
getch();
}