Question: Is there any C program which I can run on a Linux box, and will create a csv file of given dimensions(rows x columns) and store it on hard disk?

Answer: 
A CSV file is just a plain text file with Comma Separated Values and you can therefore create it by hand in an plain text editor. There is a specification in [RFC 4180](http://www.ietf.org/rfc/rfc4180.txt).

Often the first row is used for column names such as:

```

Name, Account no, Amount
Niels, 1234, $0.99
Thomas, 8888, $10.00
Per, 3454, $9.00
Rasmus, 9412, $99.99

```

A small c program to create an plain and empty CSV file could look like:

```
/*
 * makecsv.c 
 */

#include <stdio.h>

int main(int argc, char **argv) {
   if( argc != 3) {
      printf("Mandatory arguments: <rows> <cols>\n");
         return 1;
      }

      int row, col;
      for(row = 0; row < atoi(argv[1]); row++) {
         for(col = 0; col < atoi(argv[2]); col++) {
            if(col > 0) {
               printf(", ");
            }
            /* Default values are "row x col" */
            printf("\"%dx%d\"", row, col);
         }
         printf("\r\n");
       }
       return 0;
}

```

I'd compile and run it with the following commands:

```

$ gcc -o makecvs makecsv.c 
$ ./makecvs 3 4
"0x0", "0x1", "0x2", "0x3"
"1x0", "1x1", "1x2", "1x3"
"2x0", "2x1", "2x2", "2x3"

$

```

To place the output in a file "the unix way", pipe the output to file using the following commands:

```

$ ./makecvs 3 4 > myFile.csv

```
If you're looking for an existing utility you're probably on the wrong site, but something like this would print an empty CSV file with double-quoted cells and no header row:

```
for (int i = 0; i < rows; ++i) {
    for (int j = 0; j < cols-1; ++j) {
        printf("\"\",");
    }
    printf("\"\"\n");
}

```

Taking some arbitrary data and turning it into a CSV file is harder. First, what's the input data format? Second, escape the data correctly.