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.

Can you open and read an CSV file in OnlineGDB?

+5 votes
asked Mar 25, 2025 by Dmitrii Ivanov (170 points)

I am trying to open and read a CSV type file (language C), however i get an error. I use FILE* data = fopen("data.csv", "r"); to open the file, and get the following error message:

/usr/bin/ld:g2022_2023_ice.csv: file format not recognized; treating as linker script
/usr/bin/ld:g2022_2023_ice.csv:1: syntax error
collect2: error: ld returned 1 exit status
Is there a way to fix this? From what I understand the compiler is trying to run my CSV
file instead of the actual C file.

1 Answer

0 votes
answered Mar 26, 2025 by Peter Minarik (101,340 points)
I believe the problem is that OnlineGDB will assume any file in your project is a source file, even if it's a .csv file. Obviously, .csv files cannot interpreted as a proper C source code. The only exception I've found so far is a .txt file.

What you can do is instead of calling your file a .csv file, you can call it a .txt file with the same content so OnlineGDB would not be confused anymore.

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