【平安夜散分】武偉進
程序代码:
#include <cstdio>
#include <cstdlib>
#include "common.h"
#include "database.h"
/*
Field Student_Fields[] = {
{ "学号", 'I', 4, 0 },
{ "姓名", 'C', 30, 0 },
{ "性别", 'C', 1, 0 },
{ "年龄", 'I', 2, 0 },
{ "身份证", 'C', 18, 0 },
{ "联系电话", 'C', 20, 0 },
{ "地址", 'C', 50, 0 }
};
Header Student_Header = { _countof(Student_Fields), Student_Fields };
*/
Header Student_Header;
void List_Fields(const Header* header);
int main(int argc, char* argv[])
{
if (argc < 2)
{
printf_s("命令格式: %s 数据文件名\n", Get_FileName(argv[0]));
Pause();
return EXIT_FAILURE;
}
FILE* file;
if (fopen_s(&file, argv[1], "rt") == 0)
{
Load_Header(file, &Student_Header);
fclose(file);
List_Fields(&Student_Header);
}
//Create_Table(argv[1], &Student_Header);
Pause();
return EXIT_SUCCESS;
}
void List_Fields(const Header* header)
{
size_t index;
for (index = 0; index < header->Field_Number; ++index)
{
printf_s("%s %c %d,%d\n",
header->Fields[index].Name,
header->Fields[index].Type,
header->Fields[index].Length,
header->Fields[index].Decimal);
}
}










码了多少行代码了?如果用户写了写数据进去,要删除,添加些字段肿么办?还有用户一不小心修改到表头数据?