CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Initialize and read a file contents (http://www.cfd-online.com/Forums/fluent/37227-initialize-read-file-contents.html)

David Baker July 11, 2005 08:26

Initialize and read a file contents
 
Hi,

I have wrote below udf to read some data from a file. I got error. What is wrong? I think file doesn't open.

-----------------------------

#include "udf.h"

real inlet[2000][2];

int NI;

char *fname1="d:\\prj\\unsteady\\rpm3500\\inlet.dat";

DEFINE_INIT(initializ,d)

{

FILE *fp;

int i;

fp=fopen(fname1,"r");

fscanf(fp,"%d\n",NI);

fscanf(fp,"%f %f\n",&inlet[i][1],&inlet[i][2]);

printf("NI=%d\n",NI);

fclose(fp);

}

------------------------------


All times are GMT -4. The time now is 14:39.