Click here to Skip to main content
15,920,217 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionerror in m_DateStart.SetFormat("MM/dd/yyy"); Pin
Tara149-Jul-06 4:18
Tara149-Jul-06 4:18 
AnswerRe: error in m_DateStart.SetFormat("MM/dd/yyy"); Pin
ThatsAlok9-Jul-06 20:33
ThatsAlok9-Jul-06 20:33 
GeneralRe: error in m_DateStart.SetFormat("MM/dd/yyy"); [modified] Pin
Tara149-Jul-06 21:16
Tara149-Jul-06 21:16 
QuestionFAX management programatically Pin
Rilhas9-Jul-06 3:11
Rilhas9-Jul-06 3:11 
QuestionADO.NET in MFC 6 Pin
Shai`tan9-Jul-06 2:42
Shai`tan9-Jul-06 2:42 
AnswerRe: ADO.NET in MFC 6 Pin
Nemanja Trifunovic9-Jul-06 3:12
Nemanja Trifunovic9-Jul-06 3:12 
QuestionCTabCtrl with centre justified tabs. Pin
Yokeldj9-Jul-06 1:41
Yokeldj9-Jul-06 1:41 
QuestionsharingViolation error Pin
paperke679-Jul-06 1:22
paperke679-Jul-06 1:22 
Hi,

I wrote an application( simulator) that creates a textfile, with some lines of text in it. This same application also deletes this textfile after a couple of seconds. This process repeats itself over and over again. So the outputfile is present for lets say 5 seconds and gets deleted for about the same amount of time.

This simulation file gets created with the following code :

CStdioFile OutFile;

if (OutFile.Open(m_strOutFileName, CFile::modeWrite | CFile::modeCreate | CFile::shareExclusive))
{
...
}

Then I wrote a second application, which checks every 100 millisec if the simulation file is present, and if so reads it in and processes it. This is done with following statements :

int CTimer::Scan(CPLine *pPLine, LPCTSTR lpszPFInPath, BOOL bInBuf)
{
int nBCCnt = 0;

try
{
CString strBC;
CStringArray BufArr;

CStdioFile inFile(lpszPFInPath, CFile::modeRead | CFile::shareExclusive);

while (inFile.ReadString(strBC))
{
if (strBC[0] == _T('\"'))
strBC.Delete(0);
if (strBC[strBC.GetLength() - 1] == _T('\"'))
strBC.Delete(strBC.GetLength() - 1);

if (bInBuf)
BufArr.Add(strBC);
else
{
if (LookupBC(pPLine, strBC))
nBCCnt++;
}
}

inFile.Close();

if (bInBuf)
{
int nSize = BufArr.GetSize();

for (int i = 0; i < nSize; i++)
if (LookupBC(pPLine, BufArr.GetAt(i)))
nBCCnt++;
}
}
catch (CFileException *e)
{
e->Delete();

nBCCnt = -1;
}

return nBCCnt;
}

When I run both applications, I sometimes receive the follow message :

CFile exception: sharingViolation, File C:\WINDOWS\Temp\L7.dta, OS error information = 32.
First-chance exception in PCnt.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.

What is wrong here and how can I prevent this error ??

tia.
AnswerRe: sharingViolation error [modified] Pin
bob169729-Jul-06 9:15
bob169729-Jul-06 9:15 
GeneralRe: sharingViolation error Pin
earl10-Jul-06 5:02
earl10-Jul-06 5:02 
GeneralRe: sharingViolation error Pin
bob1697210-Jul-06 10:52
bob1697210-Jul-06 10:52 
GeneralRe: sharingViolation error Pin
earl10-Jul-06 11:13
earl10-Jul-06 11:13 
QuestionCRichEdit right click Pin
YaronNir8-Jul-06 22:48
YaronNir8-Jul-06 22:48 
QuestionCreating a custom control? Pin
Lord Kixdemp8-Jul-06 16:45
Lord Kixdemp8-Jul-06 16:45 
AnswerRe: Creating a custom control? Pin
Sarath C9-Jul-06 0:50
Sarath C9-Jul-06 0:50 
GeneralRe: Creating a custom control? [modified] Pin
Lord Kixdemp9-Jul-06 14:12
Lord Kixdemp9-Jul-06 14:12 
QuestionHelp calling and using a functions in visual c++ 6 Pin
method0078-Jul-06 12:35
method0078-Jul-06 12:35 
QuestionProblem with 2DGraph of Nikolai Teofilov Pin
ensger8-Jul-06 8:15
ensger8-Jul-06 8:15 
AnswerRe: Problem with 2DGraph of Nikolai Teofilov Pin
Jun Du8-Jul-06 9:46
Jun Du8-Jul-06 9:46 
Questionhow to detect internet connection availability ? Pin
tns_ranjith8-Jul-06 4:20
tns_ranjith8-Jul-06 4:20 
AnswerRe: how to detect internet connection availability ? Pin
includeh108-Jul-06 6:16
includeh108-Jul-06 6:16 
AnswerRe: how to detect internet connection availability ? Pin
PJ Arends8-Jul-06 7:44
professionalPJ Arends8-Jul-06 7:44 
QuestionAvailable/installed RAM Pin
RomTibi8-Jul-06 3:10
RomTibi8-Jul-06 3:10 
AnswerRe: Available/installed RAM Pin
Gary R. Wheeler8-Jul-06 3:54
Gary R. Wheeler8-Jul-06 3:54 
GeneralRe: Available/installed RAM Pin
RomTibi8-Jul-06 5:59
RomTibi8-Jul-06 5:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.