Beginner C/C++

Moderators: None (Apply to moderate this forum)
Number of threads: 5430
Number of posts: 16951

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
help regarding file handling... Posted by tobz on 14 Mar 2009 at 4:09 AM
how can save/retrieve/edit/delete the employee's data??

help me please...T_T..

here's my draft codes...

#include<iostream.h>
#include<process.h>
#include<conio.h>



struct person_info{
char employee[15],address[33];
int emp_id,age;
}empl;

struct payroll{
float basic,cola,gp,netpay;
float sss,love,med,tax,totald;
int rate,day;
}pay;


main(void){
clrscr();
char str[10];
int choice;
cout<<"M E N U"<<endl;
cout<<"[1]add employee"<<endl;
cout<<"[2]show information"<<endl;
cout<<"[3]exit"<<endl;
cout<<"E N T E R C H O I C E:";
cin>>choice;
switch(choice){
case 1:
clrscr();
cout<<"Employee Information"<<endl;
cout<<"enter employee:";
cin>>empl.employee;
cout<<"enter address:";
cin>>empl.address;
cout<<"enter age:";
cin>>empl.age;
cout<<"enter employee's ID:";
cin>>empl.emp_id;
cout<<"payroll entry"<<endl;
cout<<"enter rate:";
cin>>pay.rate;
cout<<"enter day:";
cin>>pay.day;
getche();main();
break;
case 2:
cout<<"display Information:"<<endl;
cout<<"employee name:"<<empl.employee<<endl;
cout<<"employee address:"<<empl.address<<endl;
cout<<"employee ID:"<<empl.emp_id<<endl;
cout<<"employee age:"<<empl.age<<endl;
cout<<"payslip information:"<<endl;
cout<<"rate per day:"<<pay.rate<<endl;
cout<<"number of days work:"<<pay.day<<endl;
getche();
main();
break;
case 3:
exit(0);break;
default:
cout<<"Invalid input";
getche();
main();
}
getche();
}

hope someone will help me...T_T..

thx..
Report
Re: help regarding file handling... Posted by AsmGuru62 on 14 Mar 2009 at 4:59 AM

Your code only deals with a single item. Each next item you enter will override the previous one. To resolve this you need an array of items:

typedef struct
{
...
}
EMPLOYEE;

EMPLOYEE ArrayOfPeople [32]; // 32 persons stored
int NumArrayOfPeople;


When you add employees - you need to append each structure at the end of this array:

void function_add_employee ()
{
  EMPLOYEE employee;

  //... fill 'employee' structure with input from cin.

  ArrayOfPeople [NumArrayOfPeople++] = employee;
}


Call this function in response to the command to add employee. To load/save this array into a file use following:

void function_save ()
{
  FILE* f = fopen ("<filename you are using to save data>", "wb");
  if (f == NULL) return;

  fwrite (&NumArrayOfPeople, sizeof (int), 1, f);
  fwrite (ArrayOfPeople, sizeof (EMPLOYEE), NumArrayOfPeople, f);
  fclose (f);
}

void function_load ()
{
  FILE* f = fopen ("<filename you are using to save data>", "rb");
  if (f == NULL) return;

  fread (&NumArrayOfPeople, sizeof (int), 1, f);
  fread (ArrayOfPeople, sizeof (EMPLOYEE), NumArrayOfPeople, f);
  fclose (f);
}


And why you calling main() from main()? Not a good idea. Use a while() loop instead. Turbo C has a small stack by default - you can run out easily if your code runs long enough.

To display the list of employees - you need to recode it a little - make a loop where you will be using index to access the next person from the array and print that info.
Report
Re: help regarding file handling... Posted by tobz on 14 Mar 2009 at 7:37 AM
can you please explain further because I don't know exactly how to apply the codes that you've given...

I know there's terribly wrong on what i did with your codes...



#include<iostream.h>
#include<process.h>
#include<conio.h>
#include<stdio.h>




typedef struct
{
char employee[15],address[33];
int emp_id,age;
}
EMPLOYEE;

EMPLOYEE ArrayOfPeople [32]; // 32 persons stored
int NumArrayOfPeople;


struct payroll{
float basic,cola,gp,netpay;
float sss,love,med,tax,totald;
int rate,day;
}pay;


void function_add_employee ();
void function_save ();
void function_load ();


main(void){
clrscr();
char str[10];
int choice;
cout<<"M E N U"<<endl;
cout<<"[1]add employee"<<endl;
cout<<"[2]show information"<<endl;
cout<<"[3]exit"<<endl;
cout<<"E N T E R C H O I C E:";
cin>>choice;
switch(choice){
case 1:
clrscr();
function_add_employee ();
getche();main();
break;
case 2:
clrscr();
function_load ();
getche();
main();
break;
case 3:
clrscr();
function_save ();
getche();
break;
case 4:exit(0);
break;
default:
cout<<"Invalid input";
getche();
main();
}
getche();
}

void function_add_employee ()
{
EMPLOYEE employee;

clrscr();
cout<<"Employee Information"<<endl;
cout<<"enter employee:";
cin>>empl.employee;
cout<<"enter address:";
cin>>empl.address;
cout<<"enter age:";
cin>>empl.age;
cout<<"enter employee's ID:";
cin>>empl.emp_id;
cout<<"payroll entry"<<endl;
cout<<"enter rate:";
cin>>pay.rate;
cout<<"enter day:";
cin>>pay.day;

ArrayOfPeople [NumArrayOfPeople++] = employee;
}



void function_save ()
{
FILE* f = fopen ("D:\oi.txt", "wb");
if (f == NULL) return;

fwrite (&NumArrayOfPeople, sizeof (int), 1, f);
fwrite (ArrayOfPeople, sizeof (EMPLOYEE), NumArrayOfPeople, f);
fclose (f);
}

void function_load ()
{
FILE* f = fopen ("D:\oi.txt", "rb");
if (f == NULL) return;

fread (&NumArrayOfPeople, sizeof (int), 1, f);
fread (ArrayOfPeople, sizeof (EMPLOYEE), NumArrayOfPeople, f);
fclose (f);
}

Report
Re: help regarding file handling... Posted by AsmGuru62 on 14 Mar 2009 at 11:28 PM
You need to stop using main() as an entrance to next menu action. Use following pseudo-code:
int running=1;

...

int main ()
{
  function_load ();

  while (running)
  {
    print_menu ();
    cin >> choice;

    switch (choice)
    {
      case 1:
        function_add_employee ();
        break;

      case 2:
        function_show_info ();
        break;

      case 3:
        running = 0;
        break;
    }
  }

  function_save ();
  return 0;
}

What show_info supposed to do? If you have 10 people in your file - which one do you show?
Report
Re: help regarding file handling... Posted by toddlerasim on 16 Mar 2009 at 7:41 AM
Correct me if I am making a horrible mistake, but why not write each record to the file after the structure has been filled in. This, I think, should avoid the limits set by the array. I have been doing it for some time with no working problems yet but then I could be just plain lucky.

Regarding the question on editing a record you need to use the fseek() function. The parameters being....

int fseek(FILE *stream, long offset,int origin);

The first parameter is obviously your file pointer. The second is the record you wish to edit. Here it should be borne in mind that this parameter should be minus one from the record you want to edit. For example, if you wish to edit the ninth record then the parameter should read as 8*sizeof(your structure). This will position your pointer to the beginning of your 9th. record. The last parameter can be one of the following three...

SEEK_CUR .... Current position of your pointer.
SEEK_END .... End of File.
SEEK_SET .... Beginning of file.

Typically SEEK_SET is used to set the pointer for the record you wish to edit. Use the fread() function as usual setting the pointer to sizeof(your structure). The third parameter should,however, be set to 1. Edit the record and write back to the file using the same parameters as given for fread().

To delete a record it is simply a matter of having an extra member in your structure which will show the status of the record. If you have to delete record 100 merely read that record back, edit the status field by setting it to D or whatever you prefer and writing it back. Now next when you browse the file just ensure that the file is read sequentially and when a D is encountered in the status field to move
to the next record. You can update your database by reading all records whose status is not having a D and writing them to a temporary file. Once done delete the original file and rename the temporary file to the database name one. Hope this helps you out. Now try inserting a record within your database using the the same functions. It is not really difficult.

But then I am just a toddler in C/C++.

Report
Re: help regarding file handling... Posted by tobz on 17 Mar 2009 at 3:53 AM
I can't do this project on time...

there's still something wrong on saving and showing information..

#include<iostream.h>
#include<process.h>
#include<conio.h>
#include<stdio.h>


typedef struct
{
char employee[15],address[33];
int emp_id,age;
}
EMPLOYEE;

EMPLOYEE ArrayOfPeople [32]; // 32 persons stored
int NumArrayOfPeople;


struct payroll{
float basic,cola,gp,netpay;
float sss,love,med,tax,totald;
int rate,day;
}pay;


void print_menu ();
void function_add_employee ();
void function_save ();
void function_show_info ();
int running=1;


int main ()
{
int choice;
function_show_info ();

while (running)
{
print_menu ();
cin >> choice;

switch (choice)
{
case 1:
function_add_employee ();
getche();
break;

case 2:
function_show_info ();
break;

case 3:
running = 0;
break;
}
}

function_save ();
return 0;
}





void function_add_employee ()
{
EMPLOYEE employee;

clrscr();
cout<<"Employee Information"<<endl;
cout<<"enter employee:";
cin>>employee.employee;
cout<<"enter address:";
cin>>employee.address;
cout<<"enter age:";
cin>>employee.age;
cout<<"enter employee's ID:";
cin>>employee.emp_id;
cout<<"payroll entry"<<endl;
cout<<"enter rate:";
cin>>pay.rate;
cout<<"enter day:";
cin>>pay.day;

ArrayOfPeople [NumArrayOfPeople++] = employee;
}



void function_save ()
{
FILE* f = fopen ("D:\oi.txt", "wb");
if (f == NULL) return;

fwrite (&NumArrayOfPeople, sizeof (int), 1, f);
fwrite (ArrayOfPeople, sizeof (EMPLOYEE), NumArrayOfPeople, f);
fclose (f);
}

void function_show_info ()
{
FILE* f = fopen ("D:\oi.txt", "rb");
if (f == NULL) return;

cout<<"display Information:"<<endl;
cout<<"employee name:"<<empl.employee<<endl;
cout<<"employee address:"<<empl.address<<endl;
cout<<"employee ID:"<<empl.emp_id<<endl;
cout<<"employee age:"<<empl.age<<endl;
cout<<"payslip information:"<<endl;
cout<<"rate per day:"<<pay.rate<<endl;
cout<<"number of days work:"<<pay.day<<endl;


fread (&NumArrayOfPeople, sizeof (int), 1, f);
fread (ArrayOfPeople, sizeof (EMPLOYEE), NumArrayOfPeople, f);
fclose (f);
}



void print_menu ()
{
clrscr();
char str[10];
cout<<"M E N U"<<endl;
cout<<"[1]add employee"<<endl;
cout<<"[2]show information"<<endl;
cout<<"[3]exit"<<endl;
cout<<"E N T E R C H O I C E:";

}

thx alot...
Report
Re: help regarding file handling... Posted by AsmGuru62 on 17 Mar 2009 at 4:09 AM

You did not answer my question of "what does show_info() supposed to do?"Also, show_info() and load() are separate actions, so why put them both into one function?
Report
Re: help regarding file handling... Posted by toddlerasim on 17 Mar 2009 at 6:41 AM
How could I have overlooked this. I think your file is not being created on the hard disk since you are using the following syntax for it...

FILE* f = fopen ("D:\oi.txt", "wb");

There is only one \ whereas there should be two..like this...

FILE* f = fopen ("D:\\oi.txt", "wb");

Secondly, why are you using the write mode in your file open. This simply deletes the existing file and all previous data is lost. I would suggest you use this ...

FILE* f = fopen ("D:\\oi.txt", "a");

The reason why you use two slashes is simply this...

C reads the first \ as an escape sequence and for the function to read a path definer we need to add a second \. Hence \\. To write the file use this...

fwrite(&your_structure, sizeof(your_structure),1 , f);

Reading back use fread() which has the same parameters as fwrite(). To read the entire file use fread() within a while statement as such..

while(fread(&your_structure, sizeof(your_structure),1,f)==1)
{

Here you cout all the details you want to see on the screen.

}

There is a reason for the 1 after the equal sign. I leave it to you to find out.

Hope this helps.

But then I am a toddler in C/C++.

Report
Re: help regarding file handling... Posted by tobz on 18 Mar 2009 at 2:10 AM
can you please edit my codes so i could finish it and pass it on time...it's really obvious that i'm having a hard time understanding this things and its because i'm still a begineer...i must admit programming is hard...

please help me...i only got 3 more days to go...T_T..

i just nid this options(add, save, edit, search by idnum, delete, view) for my program...

please, i'm desperate now...T_T...

actually im still in 1st year in this course so please understand my weakness...
Report
Re: help regarding file handling... Posted by toddlerasim on 18 Mar 2009 at 7:18 AM
#include <iostream.h>
#include <conio.h>

struct emp_info

{
   char rec_status;
   char name[30];
   char address[30];
   int id, age;
} employee;
void menu(void);
void add(void);
void readfile(void);
void getrecord(void);
void edit(void);
void delete(void);

int main(void)

{
clrscr();
menu();
}

void menu(void)
{
clrscr();
int choice;
cout<<"MENU"<<endl;
cout<<"1. Add Employee"<<endl;
cout<<"2. Read Complete File."<<endl
cout<<"3.Get Specific Record<<endl;
cout<<"4.Edit Record"<<endl;
cout<<"5. Delete Record"<<endl<endl;
cout<<"Enter your choice... ";
cin>>choice;
switch(choice)
{
case 1:
add();
break;
case 2:
readfile();
break;
case 3 :
getrecord();
break;
case 4:
edit();
break;
case 5:
delete();
break;
}
}

void add(void)

{
char rpt;
FILE *pf;
pf=fopen("d:\\emprecord.txt","a");
do
{
cout<<"Enter employee name.. ";
cin>>employee.name;
cout<<endl;
cout<<"Enter address.. ";
cin<<employee.add;
cout<<endl;
cout<<"Enter employee id ... ";
cin>>employee.id;
cout<<endl;
cout<<"Enter employee.age;
cin>>employee.age;
cout<<endl<<endl;
fwrite(&employee, sizeof(employee),1,pf);
cout<<"Do you wish to add another record? (y\n)";
cin>>rpt;
} while (rpt=='y' || rpt=='Y');
fclose(pf);
menu();
}

void readfile(void)
{
FILE *pf;
pf=fopen("d:\\emprecord.txt","r");
while ( fread(&employee, sizeof(employee),1,pf)==1)
{
cout<<employee.name<<endl;
cout<<employee.add<<endl;
cout<<employee.id<<endl;
cout<<employee.age<<endl<<endl<<endl;
}
fclose(pf);
getch();
menu();
}


That is your starter and should help you write the other functions as I described earlier. I have not had time to test the syntax nor build in any error capturing routines. That I leave to you.

Bur then I am a toddler in C/C++.
Report
Re: help regarding file handling... Posted by Lundin on 18 Mar 2009 at 8:26 AM
A sidenote:

sizeof(your_structure)

This is very system- and compiler dependant. It will not work if you ever port your code to another compiler. The reason for this is "struct padding".
Report
Re: help regarding file handling... Posted by toddlerasim on 18 Mar 2009 at 9:16 PM
Thanks Lundin for pointing that out to me. What should I then do to make it compiler independent. So far it appears to have worked with VC6. Have yet to try it out with Visual Studio 2008 though. The clrscr() I have used since the original question included it. Looking forward for your answer.
Report
Re: help regarding file handling... Posted by Lundin on 19 Mar 2009 at 12:40 AM
You have to call fwrite for each member of the struct.

fwrite(&employee.rec_status, sizeof(employee.rec_status),1,pf);
fwrite(&employee.name, sizeof(employee.name),1,pf);

and so on.


(Note that it is safe to use sizeof() on the arrays just because they are statically allocated. If you had a pointer to the array it wouldn't work, since sizeof() would then give the size of the pointer itself.)
Report
Re: help regarding file handling... Posted by tobz on 19 Mar 2009 at 3:03 AM
thank you so much for your help...
i'm having my enthusiasm in programming again...

btw can you pls show me an example of the fseek() function because its my first time encountering this code, our teacher did not discuss this one....
Report
Re: help regarding file handling... Posted by toddlerasim on 19 Mar 2009 at 7:11 AM
In continuation of my previous code here is a sample for the fseek() function. Do, however, keep in mind Lundin's explanation of the weakness while using the sizeof(your structure). I will be using it here since I have yet to work out the details and incorporating the same in my programs. I am sure Lundin will overlook this error on my part.

And Lundin, you are absolutely right about this code failing if a pointer to the structure had been used. It was a major oversight on my part in not highlighting this point. My apologies to all those who may have read this thread and acted on it.

Best of regards Lundin.

void getrecord(void)

{
clrscr();
int location;
FILE *pf;
pf=fopen("d:\\emprecord.txt", "r");
cout<<"Enter record number to be read... ";
cin>>location;
location=location-1;
fseek(pf, location*sizeof(employee), SEEK_SET);
fread(&employee, sizeof(employee),1,pf);
cout<<employee.name,<<endl;
cout<<employee.add<<endl;
cout<<employee.id<<endl;
cout<<employee.age<<endl;
getch();
fclose(pf);
menu();
}(


Report
Re: help regarding file handling... Posted by tobz on 20 Mar 2009 at 5:29 AM
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <process.h>


struct emp_info
{
char rec_status;
char name[30];
char address[30];
int id, age;
}employee;

void menu();
void add();
void readfile();
void delfile();
void getrecord();


void main()
{
clrscr();
menu();
getche();
}



void menu()
{
clrscr();
int choice;
cout<<"MENU"<<endl;
cout<<"1. Add Employee"<<endl;
cout<<"2. Read Complete File."<<endl;
cout<<"3. Delete all."<<endl;
cout<<"4. getrecord"<<endl;
cout<<"5. Exit"<<endl;
cout<<"Enter your choice... ";
cin>>choice;
switch(choice)
{
case 1:
clrscr();
add();
break;

case 2:
clrscr();
readfile();
break;

case 3:
clrscr();
delfile();
break;

case 4:
clrscr();
getrecord();
break;

case 5:
exit(0);
}
}

void add()
{

char choice;
FILE *pf;
pf=fopen("D:\\record.txt","a");
if((pf=fopen("D:\\record.txt", "a"))==NULL)
{
cout<<"could not open file";
exit(1);
}

cout<<"Enter employee name.. ";
gets(employee.name);
cout<<endl;
cout<<"Enter address.. ";
gets(employee.address);
cout<<endl;
cout<<"Enter employee id ... ";
cin>>employee.id;
cout<<endl;
cout<<"Enter employee age";
cin>>employee.age;
cout<<endl<<endl;
fwrite(&employee, sizeof(employee),1,pf);
fclose(pf);
cout<<"Do you wish to add another record? (y\\n)";
cin>>choice;
switch(choice)
{
case 'y':
case 'Y':
clrscr();
add();
break;
default:
menu();
}
}

void readfile()
{
FILE *pf;
pf=fopen("D:\\record.txt","r");
if((pf=fopen("D:\\record.txt", "r"))==NULL)
{
cout<<"could not open file";
}
while (fread(&employee, sizeof(employee),1,pf)==1)
{
cout<<employee.name<<endl;
cout<<employee.address<<endl;
cout<<employee.id<<endl;
cout<<employee.age<<endl<<endl<<endl;
}
fclose(pf);
getche();
menu();
}


void delfile()
{
clrscr();
char choice;
cout<<"Are you sure (y\\n)??"<<endl;
cin>>choice;
switch(choice)
{
case 'y':
case 'Y':

	remove("D:\\record.txt");
	if(remove("D:\\record.txt")==NULL)
	{
	cout<<"Oops, file not deleted";
	}
	else
	{
	cout<<"deleted";
	}
	getche();
	menu();
	break;
default:
menu();
break;
}
}

void getrecord()
{
clrscr();
char choice;
int location;
FILE *pf;
pf=fopen("D:\\record.txt", "r");
cout<<"Enter record number to be read... ";
cin>>location1;
location=location-1;
fseek(pf, location*sizeof(employee), SEEK_SET);
fread(&employee, sizeof(employee),1,pf);

if(fread(&employee, sizeof(employee),1,pf)==NULL)
{
cout<<"Oops, file not found";
}
else
{
cout<<employee.name<<endl;
cout<<employee.address<<endl;
cout<<employee.id<<endl;
cout<<employee.age<<endl;
}
getch();
fclose(pf);
cout<<"\n\n\n\nget record agen (y\\n)??"<<endl;
cin>>choice;
switch(choice)
{
case 'y':
case 'Y':

	getrecord();
	getche();
	break;
default:
menu();
break;
}
}


whenever i try to view the first employee by its record #1, the first employee is not displayed, the one that is being displayed is the second employee...

how will i edit the employees data??

honestly i don't know how..
Report
Re: help regarding file handling... Posted by toddlerasim on 20 Mar 2009 at 7:52 AM
Look at the variable location you have defined. And in cin you are using location1, a totally different variable or do I assume that was a typo?
Report
Re: help regarding file handling... Posted by tobz on 20 Mar 2009 at 8:08 AM
i already corrected it, its still not displaying the first record...

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <process.h>
#include <ctype.h>
#define maxstring 30


struct emp_info
{
char firstname[10], lastname[20], address[30];
int id, age;
}employee;

void menu();
void add();
void readfile();
void delfile();
void getrecord();
char *stringcapitalize(char *);
char buffer[maxstring + 1];



void main()
{
clrscr();
menu();
getche();
}



void menu()
{
clrscr();
int choice;
cout<<"MENU"<<endl;
cout<<"1. Add Employee"<<endl;
cout<<"2. Read Complete File."<<endl;
cout<<"3. Delete all."<<endl;
cout<<"4. getrecord"<<endl;
cout<<"5. Exit"<<endl;
cout<<"Enter your choice... ";
cin>>choice;
switch(choice)
{
case 1:
clrscr();
add();
break;

case 2:
clrscr();
readfile();
break;

case 3:
clrscr();
delfile();
break;

case 4:
clrscr();
getrecord();
break;

case 5:
exit(0);
}
}

void add()
{

char choice;
FILE *pf;
pf=fopen("D:\\record.txt","a");
if((pf=fopen("D:\\record.txt", "a"))==NULL)
{
cout<<"could not open file";
exit(1);
}

cout<<"Enter first name.. ";
gets(employee.firstname);
cout<<endl;
cout<<"Enter last name.. ";
gets(employee.lastname);
cout<<endl;
cout<<"Enter address.. ";
gets(employee.address);
cout<<endl;
cout<<"Enter employee id ... ";
cin>>employee.id;
cout<<endl;
cout<<"Enter employee age";
cin>>employee.age;
cout<<endl<<endl;
fwrite(&employee, sizeof(employee),1,pf);
fclose(pf);
cout<<"Do you wish to add another record? (y\\n)";
cin>>choice;
switch(choice)
{
case 'y':
case 'Y':
clrscr();
add();
break;
default:
menu();
}
}

void readfile()
{
FILE *pf;
pf=fopen("D:\\record.txt","r");
if((pf=fopen("D:\\record.txt", "r"))==NULL)
{
cout<<"could not open file";
}
while (fread(&employee, sizeof(employee),1,pf)==1)
{
printf("%s\n", stringcapitalize(employee.firstname));
printf("%s\n", stringcapitalize(employee.lastname));
cout<<employee.address<<endl;
cout<<employee.id<<endl;
cout<<employee.age<<endl<<endl<<endl;
}
fclose(pf);
getche();
menu();
}


void delfile()
{
clrscr();
char choice;
cout<<"Are you sure (y\\n)??"<<endl;
cin>>choice;
switch(choice)
{
case 'y':
case 'Y':

	remove("D:\\record.txt");
	if(remove("D:\\record.txt")==NULL)
	{
	cout<<"Oops, file not deleted";
	}
	else
	{
	cout<<"deleted";
	}
	getche();
	menu();
	break;
default:
menu();
break;
}
}

void getrecord()
{
clrscr();
char choice;
int location;
FILE *pf;
pf=fopen("D:\\record.txt", "r");
cout<<"Enter record number to be read... ";
cin>>location;
location=location-1;
fseek(pf, location*sizeof(employee), SEEK_SET);
fread(&employee, sizeof(employee),1,pf);

if(fread(&employee, sizeof(employee),1,pf)==NULL)
{
cout<<"Oops, file not found";
}
else
{
cout<<employee.firstname<<endl;
cout<<employee.lastname<<endl;
cout<<employee.address<<endl;
cout<<employee.id<<endl;
cout<<employee.age<<endl;
}
getch();
fclose(pf);
cout<<"\n\n\n\nget record agen (y\\n)??"<<endl;
cin>>choice;
switch(choice)
{
case 'y':
case 'Y':

	getrecord();
	getche();
	break;
default:
menu();
break;
}
}



char *
stringcapitalize(char *string)
{
char *cp;

cp=string;
*cp=toupper(*cp);
++cp;
while (*cp != '\0')
{
*cp = tolower(*cp);
++cp;
}

return (string);
}

Report
Re: help regarding file handling... Posted by tobz on 22 Mar 2009 at 1:20 AM
AsmGuru62, toddlerasim, Lundin...

thank you so much for all of your help...

thanks for wasting your time on me...

^_^
Report
Re: help regarding file handling... Posted by shaieen on 20 Mar 2009 at 7:49 AM
hi there=] is this a turbo c program? what compiler are you using? =]



http://dl4.glitter-graphics.net/pub/493/493254uhpm9tl406.gif[/img]
Report
Re: help regarding file handling... Posted by tobz on 20 Mar 2009 at 8:11 AM
hello...yes its turbo c...
Report
Re: help regarding file handling... Posted by shaieen on 20 Mar 2009 at 8:23 AM
ayt? okay2, il try running this one again..hmm.. looks like there are lots of errors huh. idunno, how to CHECk those.
http://dl4.glitter-graphics.net/pub/493/493254uhpm9tl406.gif[/img]
Report
This post has been deleted. Posted by shaieen on 20 Mar 2009 at 8:24 AM
This post has been deleted.
1 2  Next



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.