如何在(C)中从我的文本文件中删除/更新记录
我有一个文本文件和存储记录在这个c语言。我插入和选择是好的工作很好。但删除和更新不起作用: 我的选择代码工作正常:如何在(C)中从我的文本文件中删除/更新记录,c,linked-list,C,Linked List,我有一个文本文件和存储记录在这个c语言。我插入和选择是好的工作很好。但删除和更新不起作用: 我的选择代码工作正常: void SQLselect(const struct TokenList *list, const struct TableStructureInfo *const tableStructure) { struct Table table; if (tableStructure == NULL) return; table = SQLloadTable(list
void SQLselect(const struct TokenList *list, const struct TableStructureInfo *const tableStructure)
{
struct Table table;
if (tableStructure == NULL)
return;
table = SQLloadTable(list, tableStructure);
SQLprintTable(&table);
}
我编写了删除函数,但不起作用:
void SQLdelete(struct TokenList *list, const struct TableStructureInfo *const tableStructure)
{
struct Table filteredTable;
struct Table fullTable;
size_t filteredRowIndex;
size_t fullRowIndex;
struct TokenList *nextNode;
if (tableStructure == NULL)
return;
filteredTable = SQLloadTable(list, tableStructure);
nextNode = list->next;
list->next = NULL;
fullTable = SQLloadTable(list, tableStructure);
list->next = nextNode;
fullRowIndex = 0;
for (filteredRowIndex = 0 ; filteredRowIndex < filteredTable.rowCount ; ++filteredRowIndex)
{
// fullTable.rows[fullRowIndex++] =
}
}
其中定义了
标记列表
,表结构信息
等。SQLloadTable()
的作用是什么?请提供一个可复制的示例,清楚地说明预期和实际输出。
union Value
{
int integer;
float number;
char *string;
Bool boolean;
};
struct Column
{
union Value value;
enum FieldType type;
int position;
};
struct Row
{
int index;
struct Column columns[128];
size_t columnCount;
};
struct Table
{
struct Row *rows;
size_t rowCount;
};