can't acces in a .csv file that's already opened

Hi all,

My problem is very simple.

a) I have an excel sheet that draws financial data from a software through DDE connection. That's very easely done (which is not the case if I wanted to do that directly from my software in C++)

b) anyway, so I have this software, an excel sheet in the middle, and my own software coded in c++ at the end.

c) While I fill dynamically the excel sheet with data, I want to access this data through my software.

However,

1
2
fstream ratesfile("input.xls");   
if (ratesfile.is_open()) printf("File Open\n"); else printf("File not open\n"); 


This code works if the excel file is closed. If it is open by my (which is always the case if I want to feed in the data through DDE), my software is unable to access the file. As if there's only one access possible at a time...

Can anyone help ?
fstream is for both input and output i believe, wich means you ask to write to the file, and if a file is in use, youre not allowed to write afaik

try ifstream(wich is only for reading) instead of fstream
Last edited on
Yes, just finally had this idea. Looks like it works, thanks for your time.
Topic archived. No new replies allowed.