Sorry, you need to enable JavaScript to visit this website.

Writing Values into a simple FILE in VIVADO

Unsolved
2 posts / 0 new
sekhar5505's picture
sekhar5505
Junior(0)
Writing Values into a simple FILE in VIVADO

FILE *fp;

int main()
{
init_platform();
int a, b, c, d, e;
a = 20;
b = 10;
c = 40;
d = 50;
e = 60;

fp = fopen("etc/dump.txt", "w");
if (NULL == fp)
printf("Cannot open file");

if (fp)
{
fprintf(fp, "%d\n", a);
fprintf(fp, "%d\n", b);
fprintf(fp, "%d\n", c);
fprintf(fp, "%d\n", d);
fprintf(fp, "%d\n", e);
fflush(fp);
fclose(fp);
}

printf("Hello World\n\r");

return 0;
}

In above program I didn't get file pointer fp address. I got 0x0 and output is Cannot open file
Help me how to create a file using file pointer

TroutChaser's picture
TroutChaser
Moderator(18)
See answer to your other post