Altera_Forum
Honored Contributor
19 years agofopen don't work !!
Hi to all,
I need to use the fopen function but it didn't work ? When i try a fopen it always returns NULL -> why it's ANSI C standart ?????? # include <stdio.h> FILE *fp; char string[4000]; int main() { if (fp = fopen( string , "w")) { // got a filepointer fprintf (fp,"yipie\n"); } return 0; } thx to all http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif -> Background : I have to port a program which uses a lot of fprintfs and i can set the first parameter of this function per# define at the begining of the prgram. In the original program this parameter is "stdout". I want that the frintf function writes to "string" and not to stdout. Thats why i try to do a fopen to a string (look at the example above)