更新 CSV 文件中的数据
大家好,我想使用 C 程序从 CSV 文件中读取和写入数据。但我的问题是,在运行时我的数据在行和列上都在增加。这意味着它在两个方向上不断更新。
有什么方法可以让我找到下一个列或行,例如(第 4 行,第 3 列)并将我的数据放入其中,
而且所有行不必填充相同数量的列 任何帮助将不胜感激,
谢谢
hi every one i want to read and write data from a CSV file using c program. but my problem is that at run time my data is increasing in both row wise and column wise. that means it is continuously updating in both direction.
is there any way through which i can find the next colum or row for eg (row 4 ,col 3) and place my data into it
one thing more it is not necessary that that all rows have same number of column filled
any help would be appreciated
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果准备好了,为什么不将数据保存在内存中并将其写入 csv 文件呢?或者另一种选择,只是用换行符作为新数据元素即将到来的指示器?或者也许可以选择考虑某种可以使用和修改的结构,最后写出 .csv 文件?
或者,如果结构不均匀,为什么还要坚持使用 csv?
因为我的回答有点隐藏在评论中。当前所有评论的建议是他需要一种从 csv 文件中读取内容的方法。除此之外,他还必须跟踪他想要跟踪的内容(IP 连接),并且该文件可以在 30 秒左右的时间内重新生成。
Why don't you keep the data in memory and just write it out to an csv file if you are ready? Or another option, just us a line feed as indicator that a new data element will come? Or maybe it would be an option to think about some kind of structure you can use and modify and just in the end you write out the .csv file?
Or well if the structure is that inhomogenous why stick to csv?
Because my answer is somewhat burried in the comments. The current suggestion with all the commens is that he needs a way to read in something from a csv file. Than that he has to keep track of the things he wants to track (IP connections) and that the file can be regenerated all 30 or so seconds.