I am using VC++ to generate a text file and write (via fstream) data continuously to it. I have another application2 (NOT C++) which accesses that same file which c++ appends. At the instant application2 accesses the file, new data from C++ program cannot be written to it. It seems like the new data from c++ goes to some temporary file. when application2 closes the file, new data gets updated to the file. I want the data to be written to the file in real time and be read at the same time by application2. What should I do in c++ to make new data appear in the file which is opened by application2?
C++ side:
int realTimeValues // this variable is updated continuously
FILE * pFileTXT;
while(1)
{
pFileTXT = fopen ("realTimeData.txt","a"); // Opening file in append mode
fprintf (pFileTXT, "%d\n",realTimeValues); // saving values to file
fclose (pFileTXT) // Closing the file
}
On the application2 side I can't tell how exactly its opening this file. The application is Universal Real-Time Software Oscilloscope. In the menu there is an option "read from a file"