C++을 이용하여 고정길이 레코드관리 프로그램
본 자료는 미만의 자료로 미리보기를 제공하지 않습니다.
닫기
  • 1
해당 자료는 0페이지 까지만 미리보기를 제공합니다.
0페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

C++을 이용하여 고정길이 레코드관리 프로그램에 대한 보고서 자료입니다.

목차

FixedLength.cpp

fixtext.h

header.h

person.h

본문내용

void initMyfile()
{
Header header;
Person person;
FixedTextBuffer Buff (6);
Person :: InitBuffer (Buff);
ofstream file ("myfile",ios::out);

header . Write (file);

strcpy (person.LastName, "Ames ");
strcpy (person.FirstName, "Mary ");
strcpy (person.Address, "123 Maple ");
strcpy (person.City, "Stillwater ");
strcpy (person.State, "OK");
strcpy (person.ZipCode, "74075 ");
person . Pack (Buff);
Buff . Write (file);
person . Clear();

strcpy (person.LastName, "Mason ");
strcpy (person.FirstName, "Alan ");
strcpy (person.Address, "90 Eastgate ");
strcpy (person.City, "Ada ");
strcpy (person.State, "OK");
strcpy (person.ZipCode, "74820 ");
person . Pack (Buff);
Buff . Write (file);
person . Clear();

strcpy (person.LastName, "Gear ");
strcpy (person.FirstName, "Richard ");
strcpy (person.Address, "4000 Main ");
strcpy (person.City, "Hollywood ");
strcpy (person.State, "CA");
strcpy (person.ZipCode, "92000 ");
person . Pack (Buff);
Buff . Write (file);
person . Clear();

strcpy (person.LastName, "Jackson ");
strcpy (person.FirstName, "Michael ");
strcpy (person.Address, "1234 Westgate ");
strcpy (person.City, "Hollywood ");
strcpy (person.State, "CA");
strcpy (person.ZipCode, "92000 ");
person . Pack (Buff);
Buff . Write (file);
person . Clear();

strcpy (person.LastName, "Pak ");
strcpy (person.FirstName, "Seri ");
strcpy (person.Address, "111 First ");
strcpy (person.City, "Miami ");
strcpy (person.State, "FL");
strcpy (person.ZipCode, "40000 ");
person . Pack (Buff);
Buff . Write (file);
person . Clear();

strcpy (person.LastName, "Park ");
strcpy (person.FirstName, "Chanho ");
strcpy (person.Address, "222 Second ");
strcpy (person.City, "Dallas ");
strcpy (person.State, "TX");
strcpy (person.ZipCode, "50000 ");
person . Pack (Buff);
Buff . Write (file);
file . close();

}


void showRecord()
{
int add=0, radd=0;
Person person;
FixedTextBuffer Buff (6);
Person :: InitBuffer (Buff);
ifstream file ("myfile", ios::in);
while(1) {
add = ( radd++ * 61 ) + 3;
file.seekg(add, ios::beg);
person . Pack (Buff);
Buff . Read (file);
person . Unpack (Buff);
if(strlen(person.LastName)==0) break;
if(strcmp(person.LastName,"*")) person . Print (cout, add-3);
person. Clear(); }

}

void deleteRecord()
{
int recaddr, index;
Person person;
Header h;

ifstream ifile ( "myfile", ios :: in );
h.Read(ifile);
index = h.header;
ifile.close();

FixedTextBuffer Buff (6);
Person :: InitBuffer (Buff);
strcpy (person.LastName, "*");
strcpy (person.FirstName, (char *) &index );

person . Pack ( Buff );
ofstream file ( "myfile", ios :: in );

cout << "Type record address: ";
cin >> recaddr;

if( ( recaddr % 61 ) == 0 ) {
file . seekp ( recaddr + 3, ios :: beg );
Buff . Write ( file );
file . seekp ( 0, ios :: beg );
h . header = recaddr;
h . Write( file );
cout << "Record " << recaddr << " Deleted !!\n" ;
}
else cout<< " Invalid Address !! \n";
file . close();
}
  • 가격2,000
  • 페이지수1페이지
  • 등록일2006.04.19
  • 저작시기2004.11
  • 파일형식압축파일(zip)
  • 자료번호#345002
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니