链表正在替换
Linked List is Replacing
我正在使用C++链表和Visual Studio来创建表单并将其保存到csv文件中。它在这里发生的问题是它工作正常,每次我添加时,它都会完美添加。但是在我关闭程序并重新打开并再次添加后,整个数据是 csv 文件清除并添加一个新文件。
所以基本上当我重新运行程序时,它不会添加产品,而是全部删除然后添加。
void BootLinkedList::bootSave()
{
ofstream infile;
infile.open("footwear2.csv");
Boots *node = head;
while (node != NULL)
{
infile << node->getCode() << "," << node->getBrand() << "," << node->getColor() << "," << node->getSize() << "," << node->getPrice() << "," << node->getType() << "," << node->getSoleStyle() << "," << node->getBootType() << "," << node->getBootStyle() << "," << "-" << endl;
node = node->getNext();
}
infile.close();
}
更改
infile.open("footwear2.csv");
自
infile.open("footwear2.csv", ios::out | ios::app);
见参考文献中的拘留
相关文章:
- 反向给定链表中的K节点
- 如果没有malloc,链表实现将失败
- 文本文件中的单词链表
- 努力将整数转换为链表。不知道我在这里做错了什么
- 链表,反向函数,数据结构
- 使用std::list创建循环链表
- 链表的泛型函数remove()与成员函数remove)
- 为什么不能修改对象中的值?另外,我如何改进此链表?
- 我们可以删除链表中静态内存中的节点吗
- C++,指针数组,指向双链表中的条目
- 链表中写入访问冲突的未知原因
- 如何修复链表类实现的未处理异常0xDDDDDDDD
- 打印所有链表的元素 (C++)
- 错误:需要类名(链表c++)
- 为什么C中的通用链表中存储的数据已损坏
- C++ 创建包含链表和字符串的对象的链接列表时出错
- 链表替换了前面的节点,而不是弹出到后面的节点上
- 链表正在替换
- 如何替换链表中的新操作符
- 如何替换链表中某个节点的数据