Subj : Re: Opening a file that is being created with a VB App. To : borland.public.cpp.borlandcpp From : Sebastian Ledesma Date : Mon Jun 07 2004 12:18 pm Thanks to everyone for the answer, and yes, Ed's solution works, I used it in another function to parse the file and works. But in the main code I preferred to use CreateFile since it allow better control and make my code optimized. Saludos Sebastian "Bob Gonder" escribió en el mensaje news:nbs3c0hbl03n4f7rklqubsbef9tetp5r5t@4ax.com... > >Sebastian Ledesma wrote: > >> Hello: > >> > >> I need to open a file that is being created by a Visual Basic App > >> (something like this: Open sFile2 For Binary As FileGrab2 ), i tried several > >> parameters with CreateFile without success ( hf=CreateFile(filename, > >> FILE_READ_DATA, FILE_SHARE_WRITE, lpSecurityAttributes, > >> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); ), any hints will be > >> appreciatted. > > Biggest hint is to read (and understand) the fine manual. > CreateFile( filename, GENERIC_READ, > FILE_SHARE_READ|FILE_SHARE_WRITE, /*Allow others full use */ > NULL, /* Almost always NULL unless you have special needs*/ > >> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); > > Should also OR one of the FILE_FLAG_* features so Windows can > optimise the reads. In particular, either FILE_FLAG_SEQUENTIAL_SCAN or > FILE_FLAG_RANDOM_ACCESS. Read the manual to figure out which is best > for your file. > > FILE_ATTRIBUTE_NORMAL|FILE_FLAG_RANDOM_ACCESS > .