МIНIСТЕРСТВО ОСВIТИ І НАУКИ УКРАЇНИ
Національний унiверситет "Львiвська полiтехнiка"
Звіт
про виконання лабораторної роботи № 1
на тему: «ПОСЛІДОВНИЙ МЕТОД ДОСТУПУ ДО ФАЙЛІВНА ЗОВНІШНІХ ЗАПАМ’ЯТОВУЮЧИХ ПРИСТРОЯХ»
з курсу : «Організація баз даних і знань»
Львiв 2009
Тема роботи
Послідовний метод доступу до файлів на зовнішніх запам’ятовуючих пристроях
Мета роботи
Розглянути органiзацiю i ведення файлiв послiдовного доступу; набути практичнi навички у програмуваннi алгоритмiв роботи з файлами послiдовного доступу.
Лабораторне завдання
Тема завдання: картина галерея
1. Написати програму, яка реалізує такі функції:
1.1. Друк бази даних.
1.2. Пошук запису за введеним ключем.
1.3. Видалення запису за введеним ключем.
1.4. Вставлення запису.
1.5. Модифікація запису.
2. Написати програму групового оброблення файла даних, яка реалізує наступні функції:
2.1. Створення файлу повідомлень.
2.2. Друк бази даних.
2.3. Пошук запису за введеним ключем.
2.4. Видалення запису за введеним ключем.
2.5. Вставлення запису.
2.6. Модифікація запису.
Текст програми
#include "e:\tc\BIN\bd\DECL.CPP"
void simpleMethod(void);
void groupMethod(void);
// Global Variables
char FileNameDB [FILENAME_LENGTH];
char DirNameDB [FILENAME_LENGTH];
char * BufferFileName;
char * BufferForGroupM;
Status status;
Action action;
int Key = 1;
void main (void)
{
clrscr();
printf("Insert filename of DataBase\n");
gets(FileNameDB);
// initializing file names and path
getcwd(DirNameDB, FILENAME_LENGTH);
char str [FILENAME_LENGTH];
strcpy(str, DirNameDB);
strcat(str, "\\buffer.txt");
BufferFileName = str;
char str2 [FILENAME_LENGTH];
strcpy(str2, DirNameDB);
strcat(str2, "\\bufferGM.txt");
BufferForGroupM = str2;
// begin
int answer;
while(Key)
{
// show the main menu
printf("\n%d - Simple method", SimpleHandle);
printf("\n%d - Group handle method", GroupHandle);
printf("\n%d - Show fileBD", ShowDB);
printf("\n%d - Find record", Find);
printf("\n%d - Exit\n", Exit);
scanf("%d", &answer);
switch(answer)
{
case SimpleHandle:
{
simpleMethod();
break;
};
case GroupHandle:
{
groupMethod();
break;
};
case ShowDB:
{
showDB();
break;
};
case Exit:
{
Key = 0;
break;
};
case Find:
{
FILE * file = fopen(FileNameDB ,"r");
printf("\nEnter the number of picture-gallery you want to find ");
int number;
scanf("%d", &number);
Record * pointer = findRecord(file, number);
fclose(file);
if (pointer != NULL)
{
displayRecord(*pointer);
}
else
{
printf("\nRecord not found");
}
printf("\nPress any key to continue... \n");
getch();
break;
};
case NOP:
{
break;
};
default : Key = NOP;
}
}
getch();
}
void simpleMethod()
{
int localKey=1;
int answer;
while (localKey)
{
// show menu
printf("\nSimple method"); -
printf("\n%d-Insert", Insert);
printf("\n%d-Modify", Modify);
printf("\n%d-Delete", Delete);
printf("\n%d-GoBack", GoBack);
printf("\n%d-Exit\n", Exit);
scanf("%d", &answer);
switch(answer)
{
case Insert:{
printf("\nInsert");
Record record = createRecord();
simpleInsert(record);
break;
};
case Modify:{
printf("\nModify");
FILE * sourceFile = fopen(FileNameDB,"r");
printf("\nEnter number you want to modify ");
int number;
scanf("%d", &number);
Record * pointer = findRecord(sourceFile, number);
fclose(sourceFile);
if ( pointer == NULL )
{
printf("\nrecord not found");
}
else
{
printf("\nHere is your old record");
displayRecord(*pointer);
Record newRecord = createRecord();
simpleModify(newRecord);
}
break;
};
case Delete:{
printf("\nDelete");
printf("\nEnter number you want to delete ");
int number;
scanf("%d", &number);
simpleDelete(number);
break;
};
case GoBack:{
localKey=0;
break;
};
case Exit: {
localKey=0;
Key=0;
break;
};
default: {
printf("\nwrong answer");
};
}
}
}
void groupMethod()
{
int localKey=1;
int answer;
while (localKey)
{
// show menu
printf("\nGroup method");
printf("\n%d-Insert", Insert);
printf("\n%d-Modify", Modify);
printf("\n%d-Delete", Delete);
printf("\n%d-GoBack", GoBack);
printf("\n%d-Exit", Exit);
printf("\n%d-Save\n", Save);
scanf("%d", &answer);
switch(answer)
{
case Insert:{
printf("\nInsert");
RecordG rec;
rec.record = createRecord();
rec.action = Insert;
groupInsert(rec);
break;
};
case Modify:{
printf("\nModify");
FILE * sourceFile = fopen(FileNameDB,"r");
printf("\nEnter number you want to modify ");
int number;
scanf("%d", &number);
Record * pointer = findRecord(sourceFile, number);
fclose(sourceFile);
if ( pointer == NULL )
{
FILE * buffer = fopen(BufferForGroupM,"r");
pointer = findRecordG(buffer, number);
fclose(buffer);
if ( pointer == NULL )
{
printf("\nrecord not found");
}
else
{
printf("\nHere is your old record");
displayRecord(*pointer);
Record rec = createRecord();
groupModify(rec);
}
}
else
{
printf("\nHere is your old record");
displayRecord(*pointer);
Record rec = createRecord();
groupModify(rec);
}
break;
};
case Delete:{
printf("\nDelete");
printf("\nEnter number you want to delete ");
int number;
scanf("%d", &number);
groupDelete(number);
break;
};
case GoBack:{
localKey=0;
break;
};
case Exit: {
localKey=0;
Key=0;
break;
};
case Save: {
printf("\nSave");
groupSave();
break;
};
default: {
printf("\nwrong answer");
};
}
}
}
//////////////////////////////////////////////////////////////////////////////
extern char FileNameDB [];
void showDB()
{
FILE * filepointer = fopen(FileNameDB ,"r");
Record buffer;
if (filepointer == NULL )
{
printf("\nFile not found\n");
getch();
}
else
{
while(feof(filepointer) == 0)
{
buffer = readRecord(filepointer);
displayRecord(buffer);
printf("\n\nPress 'enter' to continue...\n");
getch();
}
}
printf("\n");
delete(&buffer);
fclose(filepointer);
}
void writeRecord(FILE * filepointer, Record record)
{
fprintf(filepointer, "\n%d ", record.numberOfApplication);
fprintf(filepointer, "%d ", record.person);
fprintf(filepointer, "%s ", record.name);
fprintf(filepointer, "%s ", record.surname);
fprintf(filepointer, "%s ", record.patronymic);
fprintf(filepointer, "%s ", record.country);
fprintf(filepointer, "%s ", record.genre);
fprintf(filepointer, "%s ", record.year);
fprintf(filepointer, "%s ", record.title);
fprintf(filepointer, "%s", record.place );
}
void displayRecord(Record pointer)
{
printf("\nNumberInList: %d ", pointer.numberOfApplication);
printf("\nSex : %s ", ((pointer.person == Male)?"Male":"Female"));
printf("\nName :%s ", pointer.name);
printf("\nSurname: %s ", pointer.surname);
printf("\npatronymic: %s ", pointer.patronymic);
printf("\ncountry: %s ", pointer.country);
printf("\ngenre: %s ", pointer.genre);
printf("\nyear: %s ", pointer.year);
printf("\ntitle: %s ", pointer.title);
printf("\nplace: %s", pointer.place );
}
Record readRecord(FILE * filepointer)
{
Record buffer;
// reading data from file
fscanf(filepointer, "\n%d", &(buffer.numberOfApplication));
fscanf(filepointer, "%d", &(buffer.person));
fscanf(filepointer, "%s", buffer.name);
fscanf(filepointer, "%s", buffer.surname);
fscanf(filepointer, "%s", buffer.patronymic);
fscanf(filepointer, "%s", buffer.country);
fscanf(filepointer, "%s", &(buffer.genre));
fscanf(filepointer, "%s", &(buffer.year));
fscanf(filepointer, "%s", buffer.title);
fscanf(filepointer, "%s", buffer.place );
return buffer;
}
Record * findRecord(FILE * filepointer, int numberOfApplication)
{
Record * target = NULL;
static Record rec;
while ( feof(filepointer) == 0 )
{
rec = readRecord(filepointer);
if (rec.numberOfApplication == numberOfApplication)
{
target = &rec;
break;
}
else
{
target = NULL;
}
}
return target;
}
Record createRecord()
{
Record record;
printf("\nLet's create the record");
printf("\nEnter NumberInList ");
scanf("%d", &(record.numberOfApplication));
printf("Enter sex (0 - Male, 1 - Female) ");
scanf("%d", &record.person);
printf("Enter name of artist ");
scanf("%s", record.name);
printf("Enter surname of artist ");
scanf("%s", record.surname);
printf("Enter patronymic of artist ");
scanf("%s", record.patronymic);
printf("Enter country of artist ");
scanf("%s", record.country);
printf("Enter genre ");
scanf("%s", &(record.genre));
printf("Enter year ");
scanf("%s", &(record.year));
printf("Enter title ");
scanf(" %s", record.title);
printf("Enter place ");
scanf(" %s", record.place );
return record;
}
Record createNullRecord()
{
Record record;
record.numberOfApplication = 0;
record.person = Female;
strcpy(record.name, "unknown");
strcpy(record.surname, "unknown");
strcpy(record.patronymic, "unknown");
strcpy(record.country, "unknown");
strcpy(record.genre, "unknown");
strcpy(record.year, "unknown");
strcpy(record.title, "unknown");
strcpy(record.place , "unknown");
return record;
}
Record * findRecordG(FILE * filepointer, int numberOfApplication)
{
RecordG * target = NULL;
static RecordG recG;
while ( feof(filepointer) == 0 )
{
recG.record = readRecord(filepointer);
fscanf(filepointer, "%d", recG.action);
if ((recG.record.numberOfApplication == numberOfApplication) && (recG.action != Delete))
{
target = &recG;
//break;
}
else
{
target = NULL;
}
}
return &((*target).record);
}
/////////////////////////////////////////////////////
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <dir.h>
#include <string.h>
#include <stdlib.h>
#define FILENAME_LENGTH 70
#define NAME_LENGTH 70
#define country_LENGTH 70
#define patronymic_LENGTH 70
#define title_LENGTH 70
//#define NUMBER_OF_VISIBLE_RECORDS 70
// ==========DATA STRUCTURES============
enum Person
{
Male, Female
};
enum Action
{
Insert, Modify, Delete, Find, GoBack, Exit, Save, NOP
};
enum Status
{
SimpleHandle, GroupHandle, ShowDB
};
struct Record
{
int numberOfApplication;
Person person;
char name [NAME_LENGTH];
char surname [NAME_LENGTH];
char patronymic [patronymic_LENGTH];
char country [country_LENGTH];
char genre [NAME_LENGTH];
char year [NAME_LENGTH];
char title [title_LENGTH];
char place [FILENAME_LENGTH];
};
struct RecordG
{
Record record;
Action action;
};
struct ListItem
{
RecordG recordG;
ListItem * next;
};
// ------ PROTOTYPES --------
// basic methods
void showDB(void);
void writeRecord(FILE * , Record);
void displayRecord(Record);
Record readRecord(FILE * );
Record * findRecord(FILE * , int );
Record createRecord(void);
Record createNullRecord();
Record * findRecordG(FILE * , int);
// simple Method
void simpleInsert(Record);
void simpleDelete(int);
void simpleModify(Record);
// grouphnadle method
void groupInsert(RecordG);
void groupDelete(int);
void groupModify(Record);
void groupSave(void);
ListItem * createList(FILE * );
void groupHandleRecord(FILE *, int );
void deteteCollision(ListItem ** , ListItem * );
int getListLength(ListItem * );
void sortList(ListItem ** );
void swap(ListItem ** ,ListItem * , ListItem * );
void showList(ListItem * );
void fixCollisions(ListItem ** );
void deleteCollision(ListItem ** , ListItem * );
void deleteList(ListItem * );
// including files
#include "e:\tc\BIN\bd\BASIC.CPP"
#include "e:\tc\BIN\bd\SIMPLEM.CPP"
#include "e:\tc\BIN\bd\GROUPM.CPP"
//////////////////////////////////////////// // Global Variables
extern char FileNameDB [FILENAME_LENGTH];
extern char DirNameDB [FILENAME_LENGTH];
extern char * BufferForGroupM;
void groupInsert(RecordG recG)
{
FILE * buffer = fopen(BufferForGroupM, "a");
writeRecord(buffer, recG.record);
fprintf(buffer, " %d", recG.action);
fclose(buffer);
}
void groupDelete(int numberOfApplication)
{
RecordG recG;
recG.record = createNullRecord();
recG.record.numberOfApplication = numberOfApplication;
recG.action = Delete;
groupInsert(recG);
}
void groupModify(Record rec)
{
RecordG recG;
recG.record = rec;
recG.action = Modify;
groupInsert(recG);
}
void groupSave()
{
// read from file buffer records and create the list
FILE * file = fopen(BufferForGroupM, "r");
ListItem * head = createList(file);
fclose(file);
remove(BufferForGroupM);
sortList(&head);
// let's delete collisions
fixCollisions(&head);
// open and/or create files
file = fopen(FileNameDB, "r");
FILE * targetFile = fopen(BufferForGroupM, "w");
Record record;
Record * oldRecord = NULL;
ListItem * pointer = head;
int key = 1;
record = readRecord(file);
// begin writtin records
while ((feof(file) == 0) && (key))
{
if ( record.numberOfApplication == pointer->recordG.record.numberOfApplication )
{
// what we do when =
if ( pointer->recordG.action != Delete )
{
if (pointer->recordG.action != Modify)
{
writeRecord(targetFile, pointer->recordG.record);
}
else
{
printf("\Warning: overwrite old record by new. Number of application %d", record.numberOfApplication);
writeRecord(targetFile, pointer->recordG.record);
}
}
if ((feof(file) != 0) || (pointer->next == NULL))
{
// save the last record
if ( pointer->recordG.action == Delete )
{
oldRecord = NULL;
}
else
{
oldRecord = &record;
}
if (pointer->next == NULL)
{
pointer = NULL;
}
}
else
{
if (pointer->next != NULL)
{
pointer = pointer->next;
}
if (feof(file) == 0)
{
record = readRecord(file);
}
// cheking whether the end of file or list reached
if ((feof(file) != 0) || (pointer->next == NULL))
{
// save the last record
if ( pointer->recordG.action == Delete )
{
oldRecord = NULL;
}
else
{
oldRecord = &record;
}
}
}
//------------------------------
}
else
{
if ( record.numberOfApplication < pointer->recordG.record.numberOfApplication )
{
// what we do when <
writeRecord(targetFile, record);
record = readRecord(file);
if (feof(file) != 0)
{
oldRecord = &record;
}
//------------------------
}
else
{
// what we do when >
while ( (record.numberOfApplication > pointer->recordG.record.numberOfApplication) && (key) )
{
if ( pointer->recordG.action == Insert )
{
writeRecord(targetFile, pointer->recordG.record);
}
if ( pointer->next == NULL )
{
// save the last record
oldRecord = &record;
key = 0;
}
else
{
pointer = pointer->next;
}
}
//------------------------------
}
}
} // cycle end
if (feof(file) != 0)
{
int triger = 0;
while (pointer != NULL)
{ printf("\nok\n");
if (pointer->recordG.action == Insert)
{
if ((pointer->recordG.record.numberOfApplication < oldRecord->numberOfApplication) || (triger == 1))
{
writeRecord(targetFile, pointer->recordG.record);
pointer = pointer->next;
}
else
{
printf("\nfirst\n");
if (oldRecord != NULL)
{ printf("\nhere i am\n");
// write the last record from cycle
writeRecord(targetFile, *oldRecord);
writeRecord(targetFile, pointer->recordG.record);
}
pointer = pointer->next;
triger = 1;
}
}
else
{
oldRecord = NULL;
pointer = pointer->next;
}
}
if (triger == 0)
{
if (oldRecord != NULL)
{
writeRecord(targetFile, *oldRecord);
}
}
}
else
{
// if the list is ended
if (oldRecord != NULL)
{
// write the last record from cycle
writeRecord(targetFile, *oldRecord);
}
// if the list is end
if ( pointer == NULL)
{
Record buffer;
while (feof(file) == 0)
{
buffer = readRecord(file);
writeRecord(targetFile, buffer);
}
}
}
// close streams
fclose(targetFile);
fclose(file);
// delete list
deleteList(head);
// remove & rename files
remove(FileNameDB);
rename(BufferForGroupM, FileNameDB);
}
ListItem * createList(FILE * file)
{
RecordG recG;
recG.record = readRecord(file);
fscanf(file,"%d",&(recG.action));
ListItem * head = (ListItem *)malloc(sizeof(struct ListItem));
head->recordG = recG;
head->next = NULL;
ListItem * pointer = head;
while( feof(file)==0 )
{
recG.record = readRecord(file);
fscanf(file,"%d",&(recG.action));
pointer->next = (ListItem *)malloc(sizeof(struct ListItem));
pointer = pointer->next;
pointer->recordG = recG;
pointer->next = NULL;
}
return head;
}
int getListLength(ListItem * head)
{
ListItem * pointer = head;
int result = 0;
while (pointer != NULL)
{
pointer = pointer->next;
result++;
}
return result;
}
void sortList(ListItem ** head)
{
int i,j;
ListItem * pointer = * head;
for (i = 0; i < getListLength(*head)-1; i++)
{
for (j = 0; j < getListLength(*head)-1; j++)
{
if (pointer->recordG.record.numberOfApplication > pointer->next->recordG.record.numberOfApplication)
{
swap(head, pointer, pointer->next);
}
else
{
pointer = pointer->next;
}
}
pointer = *head;
}
}
void swap(ListItem ** head, ListItem * rec1, ListItem * rec2)
{
ListItem * buffer = rec2->next;
rec2->next = rec1;
rec1->next = buffer;
if ( rec1 == *head )
{
*head = rec2;
}
else
{
ListItem * pointerToPrev = *head;
while (pointerToPrev->next != rec1)
{
pointerToPrev = pointerToPrev->next;
}
pointerToPrev->next = rec2;
}
}
void showList(ListItem * head)
{
ListItem * pointer = head;
printf("\n");
while (pointer != NULL)
{
displayRecord(pointer->recordG.record);
pointer = pointer->next;
}
}
void deleteCollision(ListItem ** head, ListItem * rec1)
{
ListItem * forDelete;
if ( rec1 == *head )
{
forDelete = *head;
*head = (*head)->next->next;
}
else
{
ListItem * pointerToPrev = *head;
while (pointerToPrev->next != rec1)
{
pointerToPrev = pointerToPrev->next;
}
forDelete = rec1;
pointerToPrev->next = rec1->next->next;
}
free(forDelete->next);
free(forDelete);
}
void fixCollisions(ListItem ** head)
{
ListItem * pointer = *head;
while ( pointer != NULL )
{
if (pointer->recordG.record.numberOfApplication == pointer->next->recordG.record.numberOfApplication)
{
if (pointer->recordG.action == Insert)
{
if (pointer->next->recordG.action == Delete)
{
deleteCollision(head, pointer);
pointer = *head;
}
else
{
printf("\nThere is some error in buffer file(wrong action with record number %)", pointer->recordG.record.numberOfApplication);
pointer = pointer->next;
}
}
else
{
pointer = pointer->next;
}
}
else
{
pointer = pointer->next;
}
}
}
void deleteList(ListItem * head)
{
ListItem * pointer;
while (head->next != NULL)
{
pointer = head;
head = head->next;
free(pointer);
}
free(head);
}
/////////////////////////////////
extern char FileNameDB [FILENAME_LENGTH];
extern char DirNameDB [FILENAME_LENGTH];
extern char * BufferFileName;
void simpleInsert(Record record)
{
FILE * sourceFile = fopen(FileNameDB,"r");
Record recFromSF;
int triger = 0;
if ( getc(sourceFile) != EOF )
{
// set the pointer to the begin of file
fseek(sourceFile,0,SEEK_SET);
FILE * buffer = fopen(BufferFileName, "w");
recFromSF = readRecord(sourceFile);
// checking number and write
while(recFromSF.numberOfApplication < record.numberOfApplication)
{
writeRecord(buffer, recFromSF);
if ( feof(sourceFile) != 0 )
{
break;
}
else
{
recFromSF = readRecord(sourceFile);
}
}
// write that record which store in 'record'
writeRecord(buffer, record);
if (recFromSF.numberOfApplication > record.numberOfApplication)
{
writeRecord(buffer, recFromSF);
}
while ((feof(sourceFile) == 0) && (recFromSF.numberOfApplication > record.numberOfApplication))
{
recFromSF = readRecord(sourceFile);
writeRecord(buffer, recFromSF);
}
// close sreams
fclose(buffer);
fclose(sourceFile);
// remove source file and rename targetFile
remove(FileNameDB);
rename(BufferFileName, FileNameDB);
}
else
{
fclose(sourceFile);
sourceFile = fopen(FileNameDB, "w");
writeRecord(sourceFile, record);
fclose(sourceFile);
}
}
void simpleDelete(int numberOfApplication)
{
FILE * sourceFile = fopen(FileNameDB,"r");
int triger = 0;
Record recFromSource;
// if it is not empty file
if ( getc(sourceFile) != EOF )
{
fseek(sourceFile,0,SEEK_SET);
FILE * buffer = fopen(BufferFileName, "w");
// while not end of file
while ( feof(sourceFile) == 0 )
{
recFromSource = readRecord(sourceFile);
if (recFromSource.numberOfApplication != numberOfApplication)
{
writeRecord(buffer, recFromSource);
}
else
{
// it meens that we lost that record that we ought to lose
triger = 1;
}
}
if ( triger == 0 )
{
printf("\nrecord was not found\n");
}
// closing and renaming
fclose(sourceFile);
fclose(buffer);
remove(FileNameDB);
rename(BufferFileName, FileNameDB);
}
else
{
printf("\nFile not found or file is empty\n");
}
}
void simpleModify(Record newRecord)
{
// modify is a delete old record + insert new record
simpleDelete(newRecord.numberOfApplication);
simpleInsert(newRecord);
}
Результати виконання програми
Головне меню:
Приклад файлу бази даних
1 0 Ivan Ayvazovskiy konstyantinovich rosiya peyzash 1835 devyatiy_billow lviv
2 0 Ivan shishkin Ivanovich rosiya peyzach 1839 forest_dalechiti Lviv
3 0 Vasil Petrov Grigorovich rosia portrait 1850 Poetrait_Dostoevskogo Lviv
4 0 Karl Bryulov Pavlovich rosiya peyzash 1729 ostani_days_pompei Lviv
5 0 Yuriy Badger Viktorovich Ukraine peyzash 2008 vada lviv
6 1 Cvitlana Berdnuk Ivanivna Ukraine peyzash 2008 Molnia lviv
7 0 Pavlo Guzenko Davud Ukraine still_life 2008 sribnui_still_life Lviv
8 1 Anna Vasulivna Zamelyukhina Ukraine peyzash 2007 nich lviv
9 0 Pavel Kocherzhenko Dmutrovuch Ukraine peyzash 2004 vazu Lviv
10 1 Anzhela Melnikova Yrivna Ukraine peyzash 2007 Liliy Lviv
11 1 Tatyna Melnikova Yrivna Ukraine peyzach 2008 Surene Lviv
12 0 Dmutro Sevrykov Pavlovich Ukraine peyzach 2008 Kvitu Lviv
13 0 Sergey Sinelnikov Ivanovich Ukraine peyzach 2008 Pereprava Lviv
14 1 Tatyna Chebrava Vasulivna Ukraine peyzach 2008 Meteluk Lviv
15 0 Dmitriy Sevryukov Romanovuch Ukraine peyzach 2008 Lis Lviv
16 0 Sergiy Sokursriy Petrovuch Ukraine portret 2008 Galy Lviv
17 0 Ivan shishkin Ivanovich rosiya peyzach 1839 zima Lviv
18 0 Vasil Petrov Grigorovich rosia portrait 1850 Poetrait_vasuly Lviv
19 0 Karl Bryulov Pavlovich rosiya peyzash 1729 chmaru Lviv
20 0 Yuriy Badger Viktorovich Ukraine peyzash 2008 conche Lviv
21 1 Cvitlana Berdnuk Ivanivna Ukraine peyzash 2008 zemly lviv
22 0 Pavlo Guzenko Davud Ukraine still_life 2008 derevo Lviv
23 1 Anna Vasulivna Zamelyukhina Ukraine peyzash 2007 zachd_conchy lviv
24 0 Dmutro Sevrykov Pavlovich Ukraine peyzach 2008 Kvitu Lviv
25 0 Sergey Sinelnikov Ivanovich Ukraine peyzach 2008 Pereprava Lviv
26 1 Tatyna Chebrava Vasulivna Ukraine peyzach 2008 Meteluk Lviv
27 1 Pavlo Horetdy Mark Poland portret 2005 Locha Lviv
28 1 nds ivhs] viseh esivh seovjh osjve esjv sjevp
29 0 Pavlo Guzenko Davud Ukraine still_life 2008 derevo Lviv
48 0 Dmutro Sevrykov Pavlovich Ukraine peyzach 2008 Kvitu Lviv
Стан бази даних після додавання запису № 30 та видаляння запису № 8 та модифікація 12
База даних
1 0 Ivan Ayvazovskiy konstyantinovich rosiya peyzash 1835 devyatiy_billow lviv
2 0 Ivan shishkin Ivanovich rosiya peyzach 1839 forest_dalechiti Lviv
3 0 Vasil Petrov Grigorovich rosia portrait 1850 Poetrait_Dostoevskogo Lviv
4 0 Karl Bryulov Pavlovich rosiya peyzash 1729 ostani_days_pompei Lviv
5 0 Yuriy Badger Viktorovich Ukraine peyzash 2008 vada lviv
6 1 Cvitlana Berdnuk Ivanivna Ukraine peyzash 2008 Molnia lviv
7 0 Pavlo Guzenko Davud Ukraine still_life 2008 sribnui_still_life Lviv
9 0 Pavel Kocherzhenko Dmutrovuch Ukraine peyzash 2004 vazu Lviv
10 1 Anzhela Melnikova Yrivna Ukraine peyzash 2007 Liliy Lviv
11 1 Tatyna Melnikova Yrivna Ukraine peyzach 2008 Surene Lviv
12 0 Anton Pavlov Ivanovuch Poland istoruchnuj 1956 Zasidka Lviv
13 0 Sergey Sinelnikov Ivanovich Ukraine peyzach 2008 Pereprava Lviv
14 1 Tatyna Chebrava Vasulivna Ukraine peyzach 2008 Meteluk Lviv
15 0 Dmitriy Sevryukov Romanovuch Ukraine peyzach 2008 Lis Lviv
16 0 Sergiy Sokursriy Petrovuch Ukraine portret 2008 Galy Lviv
17 0 Ivan shishkin Ivanovich rosiya peyzach 1839 zima Lviv
18 0 Vasil Petrov Grigorovich rosia portrait 1850 Poetrait_vasuly Lviv
19 0 Karl Bryulov Pavlovich rosiya peyzash 1729 chmaru Lviv
20 0 Yuriy Badger Viktorovich Ukraine peyzash 2008 conche Lviv
21 1 Cvitlana Berdnuk Ivanivna Ukraine peyzash 2008 zemly lviv
22 0 Pavlo Guzenko Davud Ukraine still_life 2008 derevo Lviv
23 1 Anna Vasulivna Zamelyukhina Ukraine peyzash 2007 zachd_conchy lviv
24 0 Dmutro Sevrykov Pavlovich Ukraine peyzach 2008 Kvitu Lviv
25 0 Sergey Sinelnikov Ivanovich Ukraine peyzach 2008 Pereprava Lviv
26 1 Tatyna Chebrava Vasulivna Ukraine peyzach 2008 Meteluk Lviv
27 1 Pavlo Horetdy Mark Poland portret 2005 Locha Lviv
28 1 nds ivhs] viseh esivh seovjh osjve esjv sjevp
29 0 Pavlo Guzenko Davud Ukraine still_life 2008 derevo Lviv
30 0 Vasil Petrov Grigorovich rosia postmodernizm 1850 Pofer Lviv
48 0 Dmutro Sevrykov Pavlovich Ukraine peyzach 2008 Kvitu Lviv
Висновки
На цій лабораторній роботі я розглянув органiзацiю i ведення файлiв послiдовного доступу; набув практичнi навички у програмуваннi алгоритмiв роботи з файлами послiдовного доступу.