|
[Sponsors] |
April 7, 2003, 18:26 |
SCANF
|
#1 |
Guest
Posts: n/a
|
Hello CFD community
I wonder if someone knows a function similar to scanf, which could read string from the screen window. Unfortunately, it seems that Fluent does not support this C function in its UDF. I really appreciate a suggestion of how to read strings from the window screen by a UDF. Regards Alex |
|
April 8, 2003, 11:28 |
Re: SCANF
|
#2 |
Guest
Posts: n/a
|
Hello Alex
Indeed it is not posible to use SCANF in FLUENT, you must use FSCANF instead ! (Fluent.Inc/fluent6.1/help/html/udf/node39.htm). Maybe you can put your filename in a special file, which name is unvariant, and read this file with fscanf. Thierry. |
|
April 8, 2003, 14:01 |
Re: SCANF
|
#3 |
Guest
Posts: n/a
|
Hello both, function fscanf can read from standard input in C nad C++, I am not sure if it works in Fluent. The only difference is that you use 'stdin' instead of a your pointer to a file. The screen terminal (standard input and output) is treated as a file in this programming language. Hope it helps. Vladimir
|
|
April 8, 2003, 15:44 |
Re: SCANF
|
#4 |
Guest
Posts: n/a
|
Hello Thierry!
Thanks you for thinking a solution for my problem Actually, I an using fscanf to read the file with invariant name. However, in my case I need to several data file, where the only difference between them is the name. Consequently I am looking for a C function which be able to read the name files from the MAIN FLUENT WINDOW If you know a way to read these file without changing the name in the user define, compiling and running fluent over and over it will be great. Best Regards Alex Munoz |
|
April 9, 2003, 03:51 |
Re: SCANF
|
#5 |
Guest
Posts: n/a
|
Hello Alex !
I have well understood your problem...and I think it's not possible to access directly to the main fluent window. What I suggested you is reading a file with fscanf, which name is invariant (names.txt for instance), and that includes all the filenames you need. Example : names.txt contains : filename_1 filename_2 filename_3 and you use something like that ! char filename[20]; FILE *f; FILE *g; if ((f=fopen("names.txt","r"))==NULL) { Internal_Error("NAMES.TXT NOT FOUND !!\n"); } else nb_files=3; for (i=0; i<nb_files; i++) { fscanf(f,"%s\n",filename); g=fopen(filename,"r"); ... ... fclose(g) } fclose(f) Of course you have to modify this file each time the filenames change, but you can avoid compiling the UDF. Best regards Thierry |
|
April 9, 2003, 14:33 |
Re: SCANF
|
#6 |
Guest
Posts: n/a
|
Hi Thieery
Thanks you for your suggestion, unfortunately i can not do it, The files are extremely large and If I save the cas and data file plus several scalar files, I will run out of computer storage. I guess I have to live with the problem! Thank you Alex |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
what is the format of.txt file for scanf to read | lamlash | FLUENT | 0 | July 17, 2006 18:04 |