Click to See Complete Forum and Search --> : Share Read/write file


Kacem
April 7th, 1999, 11:42 AM
Hi,

I use C language and toto is binary file

// Code A
ProtFolioHnd = CreateFile ( FileName, GENERIC_READ|GENERIC_WRITE ,
FILE_SHARE_READ,NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL , NULL );
if (ProtFolioHnd == INVALID_HANDLE_VALUE)
{ //Share violation
char Buffer[80];
_snprintf(Buffer,80,"%s : Is being used by another user.",FileName);
// Code B
ProtFolioHnd = CreateFile (FileName, GENERIC_READ, FILE_SHARE_READ, NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL );
MessageBox ( GetActiveWindow(), Buffer,"Estimates Direct", MB_OK);
}

// the process A et B are the same application in different PC
- If the process A open the file toto (binary file) // do the code A
- The process B open the file toto (binary file) // do the code B. ProtFolioHnd== -1 Why ?



Thanks