Skip to content

Instantly share code, notes, and snippets.

@ser1zw
Created September 23, 2010 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ser1zw/593256 to your computer and use it in GitHub Desktop.
Save ser1zw/593256 to your computer and use it in GitHub Desktop.
/*
CSV to Array using #include
*/
#include <stdio.h>
int main(int argc, char *argv[])
{
/* echo '10,20,30,40,50' > hoge.csv */
int hoge[] = {
#include "hoge.csv"
};
int i, size;
size = sizeof(hoge) / sizeof(hoge[0]);
for (i = 0; i < size - 1; i++)
printf("%d, ", hoge[i]);
printf("%d\n", hoge[i]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment