CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Wait for data in C language

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2007, 08:54
Default Wait for data in C language
  #1
Wang
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

  Reply With Quote

Old   October 21, 2007, 16:40
Default Re: Wait for data in C language
  #2
Alexey
Guest
 
Posts: n/a
for example, function getchar() or getch() waits for data from keyboard.
  Reply With Quote

Old   October 22, 2007, 05:58
Default Re: Wait for data in C language
  #3
Wang
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.

  Reply With Quote

Old   October 22, 2007, 08:31
Default Re: Wait for data in C language
  #4
Newton
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...
  Reply With Quote

Old   October 22, 2007, 10:54
Default Re: Wait for data in C language
  #5
Wang
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.

  Reply With Quote

Old   October 22, 2007, 15:42
Default Re: Wait for data in C language
  #6
Ahmed
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

  Reply With Quote

Old   October 22, 2007, 17:11
Default Re: Wait for data in C language
  #7
Jonas Holdeman
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.
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 01:49.