Subj : Re: Opening a file that is being created with a VB App. To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Sat Jun 05 2004 10:32 am >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 .