Add to Favorites    Make Home Page 16929 Online  
 Language Categories  
 Our Services  

Home » C Home » File Operations Home » SLAM BOOK ,YOU CAN ADD UR FRIENDS BIODATA.

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title SLAM BOOK ,YOU CAN ADD UR FRIENDS BIODATA.
Author P.NARESH KUMAR
Author Email naresh5252003 [at] google.com
Description In this project binary file concepts ,graphics fucntions
are
used. mouse pointer is used. I AM SURE
YOU WILL ENJOY BY USING MY SLAM BOOK AS MUCH I AM.
Category C » File Operations
Hits 385584
Code Select and Copy the Code
#include<graphics.h> #include<conio.h> #include<dos.h> #include<process.h> #include<stdio.h> #include<string.h> union REGS i,o; void main() { int driver,mode,x,y,but,z; //intialitions of all variables and functions driver = DETECT; int initmouse(); // to load mouse driver int resmptr(int p,int q,int r,int s); //restric mouse pointer within boundry int showmptr(); // shows mouse pointer int getmpos(int *t,int *u, int *v); // captures the current position of mouse pointer initgraph(&driver, &mode, "C:\tc\bgi"); //initialize graphics mode nare : setcolor(YELLOW); outtextxy(250,10,"MY SLAM BOOK"); setcolor(GREEN); outtextxy(70,70,"I'm sure you'll enjoy filling my slam book as much as"); outtextxy(80,80,"I will enjoy reading about you later."); setcolor(LIGHTGREEN); rectangle(30,30,635,460); rectangle(200,100,380,115); outtextxy(210,105," 1.Add Records"); rectangle(200,120,380,135); outtextxy(210,125," 2.List Records"); rectangle(200,140,380,155); outtextxy(210,145," 3.Modify Records"); rectangle(200,160,380,175); outtextxy(210,165," 4.Delete Records"); rectangle(200,180,300,195); outtextxy(210,185," 0.Exit"); if(initmouse() == 0) { // load mouse driver if not closegraph(); // exit the program restorecrtmode(); printf(" Mouse driver is not loaded"); exit(1); } showmptr(); resmptr(30,30,635,460); setcolor(RED); outtextxy(70,310,"# Press Add Records button to add a record"); outtextxy(70,330,"# Press List Records button to list records"); outtextxy(70,350,"# Press Modify Records button to modify any record"); outtextxy(70,370,"# Press Delete Records button to delete record"); setcolor(13); setcolor(YELLOW); outtextxy(200,440,"Press any key to exit program"); FILE *fp,*ft; char another,choice,ch; struct frien { char urname[40]; char emailid[40]; long int mobno; }; struct frien f; char friname[40]; long int recsize; fp=fopen("FRE.DAT","rb+"); if(fp==NULL) { fp=fopen("FRE.DAT","wr+"); if(fp==NULL) { puts("Cannot open file"); exit(0); } } recsize=sizeof(f); while(!kbhit()) // loop until any key is pressed { getmpos(&but,&x,&y); // capture current pointer position when click event happens if(x>=200 && x<=380 && y>=100 && y<=115 && (but & 1) == 1) // and switch to that if loop { clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); gotoxy(100,100); printf(" HELLO FRIEND "); fseek(fp,0,SEEK_END); another='y'; while(another=='y') { printf(" Enter ur Name:-"); scanf("%s",f.urname); printf(" Enter ur Email ID:-"); scanf("%s",f.emailid); printf(" Enter ur Mobileno:-"); scanf("%ld",&f.mobno); fwrite(&f,recsize,1,fp); printf(" 1 record has been added successfully"); printf(" Add another Record (y/n)"); outtextxy(150,380,"PRESS n TO GO TO MAIN SCREEN"); fflush(stdin); another=getche(); if(another=='n') { fflush(stdin); clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); goto nare; } } } //first if ends else if(x>=200 && x<=380 && y>=120 && y<=135 && (but & 1) == 1) { clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); outtextxy(100,370,"THESE ARE MY BEST FRIENDS,I LOVE THEM VERY MUCH"); outtextxy(100,390,"PRESS n TO GO TO MAIN SCREEN"); fseek(fp,0,SEEK_SET); printf("NAME EMAILID MOBILENO "); while(fread(&f,recsize,1,fp)==1) { printf(" "); printf("%s %s %ld ",f.urname,f.emailid,f.mobno); printf(" "); } if(getche()=='n') { fflush(stdin); clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); goto nare; } } //second if ends else if(x>=200 && x<=380 && y>=140 && y<=155 && (but & 1) == 1) { clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); setcolor(YELLOW); printf("HELLO"); another='y',ch='y'; while(another=='y') { printf(" Enter name of friend to modify:-"); scanf("%s",friname); if(strcmp(f.urname,friname)==0) { printf(" U r stored in my book"); printf(" Are you sure you want to modify the %s document",friname); printf(" Then press (y/n)"); fflush(stdin); ch=getche(); if(ch=='y') { rewind(fp); while(fread(&f,recsize,1,fp)==1) { if(strcmp(f.urname,friname)==0) { printf(" Enter ur Name:-"); scanf("%s",f.urname); printf(" Enter ur Email ID:-"); scanf("%s",f.emailid); printf(" Enter ur Mobileno:-"); scanf("%d",&f.mobno); fseek(fp,-recsize,SEEK_CUR); fwrite(&f,recsize,1,fp); printf(" 1 record has been modified successfully"); printf(" Modify another Record(y/n)"); break; } } } } else { printf(" Sorry ! U r not in my book"); printf(" U can now add urself"); } outtextxy(100,380,"PRESS n TO GO TO MAIN SCREEN"); if(getche()=='n') { fflush(stdin); clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); goto nare; } fflush(stdin); another=getche(); } }// third if ends else if(x>=200 && x<=380 && y>=160 && y<=175 && (but & 1) == 1) { clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); another='y'; while(another=='y') { printf(" Enter name of friend to delete:-"); scanf("%s",friname); if(strcmp(f.urname,friname)!=0) { printf(" Sorry ! Ur record is not available Check the name correctly"); goto sid; } ft=fopen("TEMP.DAT","wb"); rewind(fp); while(fread(&f,recsize,1,fp)==1) { if(strcmp(f.urname,friname)!=0) fwrite(&f,recsize,1,ft); } fclose(fp); fclose(ft); printf(" Are you sure,then press 'y'"); if(getche()=='y') { remove("FRE.DAT"); rename("TEMP.DAT","FRE.DAT"); } setcolor(WHITE); outtextxy(40,370,"THE RECORD IS DELETING"); rectangle(40,380,580,405); for(z=40;z<=580;z++) { setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); rectangle(40,380,z,405); delay(10); setfillstyle(SOLID_FILL,BLUE); floodfill(42,392,WHITE); } clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); sid : printf(" Delete another Record(y/n)"); fflush(stdin); another=getche(); setcolor(YELLOW); outtextxy(100,380,"PRESS n TO GO TO MAIN SCREEN"); if(another=='n') { fflush(stdin); clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); goto nare; } fp=fopen("FRE.DAT","rb+"); } }// forth if ends else if(x>=200 && x<=300 && y>=180 && y<=195 && (but & 1) == 1) { clrscr(); setfillstyle(SOLID_FILL,BLACK); floodfill(0,0,BLACK); setcolor(YELLOW); outtextxy(120,100,"THANKING YOU FOR USING MY SLAM BOOK"); getch(); fclose(fp); exit(0); }// fifth if ends } // while loop ends } // main ends getmpos(int *but,int *x,int *y) { i.x.ax = 3; int86(0x33,&i,&o); *but = o.x.bx; *x = o.x.cx; *y = o.x.dx; } initmouse() { i.x.ax = 0; int86(0x33,&i,&o); return(o.x.ax); } showmptr() { i.x.ax = 1; int86(0x33,&i,&o); } resmptr(int a,int b,int c,int d) { i.x.ax = 7; i.x.cx = a; i.x.dx = c; int86(0x33,&i,&o); i.x.ax = 8; i.x.cx = b; i.x.dx = d; int86(0x33,&i,&o); }

Related Source Codes

Script Name Author
The Game Opposite as seen on Nokia 2300 Mobile Manikanta
RECURSIVE BALANCED QUICK SORT ashish
Radix Sort ashish
Change your mouse pointer Ashim
The blinking star Shashank
Data Validation Crylittlebaby
To search a file by giving file type like mp3 or mpeg or doc Prashanth SR
Menus Demonstration B.Chidhambaram
Employee Database Project Using C. Reenku Raman Nayak
Creating a Lexical Analyzer in c fahad bader al-buhairi ¦Õ¤ ?¤Ð Ãß??ÝÐÝ
Calendar Program Omkar & Devendra
Stop double Process for start in C Cedrik Jurak
Stop double Process for start in C Cedrik Jurak
Time Scheduler Atiq Anwar
A timepass game between atmost two players Rahul Roy

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=1171


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review