[파일처리론] KeySort를 이용한 파일정렬 (주석포함)
- 최초 등록일
- 2007.06.02
- 최종 저작일
- 2007.01
- 압축파일
- 가격 1,500원
소개글
● 키 정렬(KeySorting)을 사용하여 학생번호(Student ID)순으로 정렬된 파일(intput.txt)을 이름(Name) 순으로 정렬하여 새로운 파일(output.txt)을 생성하는 프로그램입니다.
● (visual studio 6.0) C++
● 파일구성
input.txt
output.txt
read.cpp
* 모아놓은 관련 참고자료 필요하신 분은 메일 주소 남겨주시면 빠른 시간내로 확인하고 보내드리겠습니다 ^.^
컴파일 실행환경
Microsoft cisual c++ 6.0
본문내용
// *********** FixedTextBuffer ***********
// 고정크기 텍스트 필드의 특정 수를 가진 버퍼 객체
class FixedTextBuffer
{
public:
// maxFields의 최대값을 가지고 생성
FixedTextBuffer(int maxFields, int maxChars = 1000);
// 특정크기의 필드를 가지고 생성
FixedTextBuffer(int numfields, int * FieldSize);
int NumberOfFields() const;
void Clear();
int AddField(int fieldSize);
int Read(fstream &);
int Write(fstream &);
// 버퍼의 다음 필드 값을 세트
int Pack(const char *);
// 버퍼의 다음 필드 값을 추출
int Unpack(char *);
int Init(int numFields, int maxChars = 1000);
int Init(int numFields, int *fieldSize);
void SetNextCharacter(int);
private:
char * Buffer; // 필드값을 갖는 문자배열
int BufferSize; // 팩된 필드의 크기
int * FieldSize; // 필드 크기의 배열
int MaxFields; // 필드의 최대 개수
int MaxChars; // 문자열의 최대 개수
int NumFields; // 팩, 언팩될 필드의 개수
int NextField; // 정의된 필드의 실제 개수
int NumFieldsValues; // 팩된 필드의 개수
int Packing; // 팩 연산 결과를 저장하는 변수
int NextCharacter; // 버퍼에 팩, 언팩이 수행될 위치
};
압축파일 내 파일목록
output.txt
input.txt
read.cpp
참고 자료
C++을 사용한 객체지향 접근방식 화일구조 (박석역, Folk, Zoellick, Riccardi, 도서출판그린)