<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sequential File | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/sequential-file/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 09 Jun 2012 11:41:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C program to insert Student Records to a Sequential File</title>
		<link>https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-to-insert-student-records-to-a-sequential-file/</link>
					<comments>https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-to-insert-student-records-to-a-sequential-file/#respond</comments>
		
		<dc:creator><![CDATA[Ansten Lobo]]></dc:creator>
		<pubDate>Sat, 09 Jun 2012 11:41:46 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[c programs]]></category>
		<category><![CDATA[lab programs]]></category>
		<category><![CDATA[Sequential File]]></category>
		<category><![CDATA[insert records]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=3288</guid>

					<description><![CDATA[<p>Source: Dr. G T Raju, Professor &#038; Head, Dept. of CSE, RNSIT #include typedef struct { int usn; char name[25]; int m1,m2,m3; }STD; STD s; void display(FILE *); int search(FILE *,int); void main() { int i,n,usn_key,opn; FILE *fp; printf(" How many Records ? "); scanf("%d",&#038;n); fp=fopen("stud.dat","w"); for(i=0;i</p>
<p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-to-insert-student-records-to-a-sequential-file/">C program to insert Student Records to a Sequential File</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Source: Dr. G T Raju, Professor &#038; Head, Dept. of CSE, RNSIT</p>
<pre lang="C" line="1">
#include <stdio.h>
typedef struct
{
    int usn;
    char name[25];
    int m1,m2,m3;
}STD;
STD s;
void display(FILE *);
int search(FILE *,int);
void main()
{
    int i,n,usn_key,opn;
    FILE *fp;
    printf(" How many Records ? ");
    scanf("%d",&n);
    fp=fopen("stud.dat","w");
    for(i=0;i<n;i++)
    {
        printf("Read the Info for Student: %d (usn,name,m1,m2,m3) \n",i+1);
        scanf("%d%s%d%d%d",&#038;s.usn,s.name,&#038;s.m1,&#038;s.m2,&#038;s.m3);
        fwrite(&#038;s,sizeof(s),1,fp);
    }
    fclose(fp);
    fp=fopen("stud.dat","r");
    do
    {
        printf("Press 1- Display\t 2- Search\t 3- Exit\t Your Option?");
        scanf("%d",&#038;opn);
        switch(opn)
        {
        case 1: printf("\n Student Records in the File \n");
            display(fp);
            break;
        case 2: printf(" Read the USN of the student to be searched ?");
            scanf("%d",&#038;usn_key);
            if(search(fp,usn_key))
            {
                printf("Success ! Record found in the file\n");
                printf("%d\t%s\t%d\t%d\t%d\n",s.usn,s.name,s.m1,s.m2,s.m3);
            }
            else
                printf(" Failure!! Record with USN %d not found\n",usn_key);
            break;
        case 3:  printf(" Exit!! Press a key . . .");
            getch();
            break;
        default:  printf(" Invalid Option!!! Try again !!!\n");
            break;
        }
    }while(opn != 3);
    fclose(fp);
}   /* End of main() */
void display(FILE *fp)
{
    rewind(fp);
    while(fread(&#038;s,sizeof(s),1,fp))
        printf("%d\t%s\t%d\t%d\t%d\n",s.usn,s.name,s.m1,s.m2,s.m3);
}
int search(FILE *fp, int usn_key)
{
    rewind(fp);
    while(fread(&#038;s,sizeof(s),1,fp))
        if( s.usn == usn_key) return 1;
    return 0;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-to-insert-student-records-to-a-sequential-file/">C program to insert Student Records to a Sequential File</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/c-tutorials/c/c-advanced/c-program-to-insert-student-records-to-a-sequential-file/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
