Include Text Files In C Source
Join the DZone community and get the full member experience.
Join For FreeThis includes the contents of myfile.txt into the char array text.
โ
Note: This only works if ALL lines in the file are enclosed in "s.
โ
Wrong myfile.txt:
Hello world
Goodbye world
โ
โ
โ
Right myfile.txt:
"Hello world"
"Goodbyle world"
""
โ
โ
char text[] = {
}
โ
Opinions expressed by DZone contributors are their own.
Comments