|
[Sponsors] |
October 21, 2007, 08:54 |
Wait for data in C language
|
#1 |
Guest
Posts: n/a
|
Hello,
I want to code the wait for data in a C-Code. It is appreciated that you have any suggestion about it. Thanks in advance. Junye |
|
October 21, 2007, 16:40 |
Re: Wait for data in C language
|
#2 |
Guest
Posts: n/a
|
for example, function getchar() or getch() waits for data from keyboard.
|
|
October 22, 2007, 05:58 |
Re: Wait for data in C language
|
#3 |
Guest
Posts: n/a
|
Hi Alexey,
Thank for your reply. I should give more details. My problem is that when a code A is running to wait for data from another code B. Furthermore, the data from the code B is cyclic to update. The code A is waiting until the data updated. Then the code A gets the data in. |
|
October 22, 2007, 08:31 |
Re: Wait for data in C language
|
#4 |
Guest
Posts: n/a
|
Are those codes two different .exe??? If so, u can write a txt file from code B and read in code A.
Another option is to use an MPI implementation, allowing u even to parallelize those codes.... good luck... |
|
October 22, 2007, 10:54 |
Re: Wait for data in C language
|
#5 |
Guest
Posts: n/a
|
The codes are two different.exe. The option one is not suitable for my case. Because the code B update a series of txt files cyclically, the code A read in each updated data. The key problem is the code A needs to know if the txt file has been updated. Then, the code A makes a decision if to read in the data. The option two seems too complex if there are some functions in C or fortran language like MPI 'waiting'. Anyway, thanks for your suggestion.
|
|
October 22, 2007, 15:42 |
Re: Wait for data in C language
|
#6 |
Guest
Posts: n/a
|
Code A need to read the directory where the text files are produced by Code B, save the time stamp of these text files, when these files are updated they will have a new time stamp So you need to have a good reference about your operating system and know which calls Code A has to make in order to get the directory listing, I do not have my C language book at hand right now, but I am positive you can do it using the C language, Good Luck
|
|
October 22, 2007, 17:11 |
Re: Wait for data in C language
|
#7 |
Guest
Posts: n/a
|
If using Unix/Linux, can't you do this sort of thing with pipes?
Or read from a file. If it is empty, pause/sleep for a fixed time then read again. Continue until you reach an end of data flag, process data then start over. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Comparison between C/C++ and Fortran? | rick | Main CFD Forum | 45 | September 6, 2011 01:52 |
Additional Command Language -in Workbench! | Elvira_Coot | CFX | 11 | July 14, 2011 02:32 |
programming language for CFD, C, C++, FORTRAN,.... | hadian | Main CFD Forum | 15 | September 9, 2008 23:19 |
ALGOR? Its scripting language? Compare to Fluent? | Chris Bailey | Main CFD Forum | 2 | November 16, 2005 17:58 |
which c language is used in UDF | lingo | FLUENT | 2 | October 9, 2003 08:37 |