#1
|
|||
|
|||
Annoying programming question
This is for the HUD I wrote. Whenever I try to open a Absolute hand history file, whilst the client is running, I get a sharing exception. This code works with all the other clients I've come across.
try{ CFile tmpFile(fileName, CFile::modeRead | CFile::shareDenyNone ); FlushFileBuffers(tmpFile.m_hFile); tmpFile.Seek(startAt, CFile::begin); int sz = tmpFile.Read(pBuf, (long)length); } catch (CFileException *e) { e->Delete(); free (pBuf); return NULL; } The annoying part is, I just got done writing the parser. Boring work but seems to work fine with 20k hands. I thought I was almost done with Absolute, but unless I can get some help, I can see figuring out a work-around is going to be a pain in the ass. |
#2
|
|||
|
|||
Re: Annoying programming question
just an idea: what about copying the hand history file to a new folder?
|
#3
|
|||
|
|||
Re: Annoying programming question
It looks like Absolute specifically denies sharing when it opens the hand history files, just using shareDenyNone won't allow you to access it.
I'm pretty sure there has to be a workaround though. It often happens to me that media player classic or zoomplayer cannot open a file I'm still downloading with restricted sharing, but mplayer can usually open it fine. Although it's a little bit overkill and some search on that specific subject should give you the answer, mplayer is open-source if you really can't find a solution. |
#4
|
|||
|
|||
Re: Annoying programming question
[ QUOTE ]
just an idea: what about copying the hand history file to a new folder? [/ QUOTE ] You mean to make a copy of the file from within the program and then read that? Because it's a little impractical to keep copying by hand - especially if you are multi-tabling [img]/images/graemlins/smile.gif[/img] But how do I copy it if I can't read it in the first place? |
#5
|
|||
|
|||
Re: Annoying programming question
[ QUOTE ]
[ QUOTE ] just an idea: what about copying the hand history file to a new folder? [/ QUOTE ] You mean to make a copy of the file from within the program and then read that? Because it's a little impractical to keep copying by hand - especially if you are multi-tabling [img]/images/graemlins/smile.gif[/img] But how do I copy it if I can't read it in the first place? [/ QUOTE ] Yep, the only temp fix I can think of is to make a temporary copy of the file using C's system() function, eg: system("copy src temp"); Juk [img]/images/graemlins/smile.gif[/img] |
#6
|
|||
|
|||
Re: Annoying programming question
Thx... I did a
CopyFile(fileName, "tmp", 0); and that seemed to work. |
#7
|
|||
|
|||
Re: Annoying programming question
[ QUOTE ]
Thx... I did a CopyFile(fileName, "tmp", 0); and that seemed to work. [/ QUOTE ] Strange, why don't the sharing restrictions apply to Windows itself? |
#8
|
|||
|
|||
Re: Annoying programming question
[ QUOTE ]
[ QUOTE ] Thx... I did a CopyFile(fileName, "tmp", 0); and that seemed to work. [/ QUOTE ] Strange, why don't the sharing restrictions apply to Windows itself? [/ QUOTE ] since when did microsoft follow specifications? |
#9
|
|||
|
|||
Re: Annoying programming question
from my experience
"copy something.smh" works every time because it doesn't need an access to the file. It just copies bytes = it doesn't interfere with the file itself. So as long as the user has "read" right he can copy it. |
|
|