Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

C coding question - data file

+8 votes
asked Apr 12 by Mister Fork (200 points)
Hi everyone,

I'm writing a small c program to read data from a csv file and then reformats it into an output file. Is it possible do that in this environment? My program is called main.c, data is data.csv, and my output is report.txt.

1 Answer

0 votes
answered Apr 15 by Peter Minarik (86,430 points)
edited Apr 15 by Peter Minarik

Sure it is. Just make sure you add your data.csv to your project and when all run, download the report.txt from the online project (it gets added automatically to your project when the report is created).

I've created a small example to help you start on your journey: https://onlinegdb.com/mVz25nX9o

I've found out that if your input file is a .csv file, the compiler tries to interpret the file and it causes you a build error as OnlineGDB tries to compile every file included in the project. However, it's smart enough to not try to include .txt file, so if you use a .txt extension instead of a .csv, you should be good.

See the "data.txt" command line argument in my example project. Note, that the example project has a few configuration options. Check the function Configure() for more details.

Good luck!

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...