Click here to Skip to main content
15,890,995 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Using __toascii() got me a runtime access violation Pin
Maxwell Chen25-Feb-08 19:46
Maxwell Chen25-Feb-08 19:46 
GeneralRe: Using __toascii() got me a runtime access violation Pin
Mark Salsbery26-Feb-08 5:16
Mark Salsbery26-Feb-08 5:16 
GeneralRe: Using __toascii() got me a runtime access violation Pin
glyfyx27-Feb-08 3:03
glyfyx27-Feb-08 3:03 
GeneralRe: Using __toascii() got me a runtime access violation Pin
Rajkumar R25-Feb-08 19:10
Rajkumar R25-Feb-08 19:10 
GeneralRe: Using __toascii() got me a runtime access violation Pin
Mark Salsbery25-Feb-08 19:12
Mark Salsbery25-Feb-08 19:12 
GeneralWithout Installing How to MatLab run when VC++ Button Pressed... Pin
johnalek25-Feb-08 18:42
johnalek25-Feb-08 18:42 
QuestionHow to Configure the Matlab Add-in for Visual Studio vc++ 6.0 Pin
johnalek25-Feb-08 18:36
johnalek25-Feb-08 18:36 
GeneralUnlocking a file.. Pin
sharanu25-Feb-08 17:44
sharanu25-Feb-08 17:44 
Hi all
I am locking a file.First times it locks..but second time if i want to unlock..it is not unlocking the file..plz help me ..here is the code....



int LockFile(char *cFileName, bool bLock)
{
int iFile;
if(bLock)
{
iFile = _open(strcat(cFileName, ".lck"), _O_CREAT | _O_EXCL | _O_RDWR);

_close(iFile);

if(iFile < 0)
{
printf("File locked by another process");
return -1;
}

printf("File is locked for writting");
return iFile;

}
else
{
iFile = remove(strcat(cFileName, ""));
if(iFile == -1)
{
printf("Error in file unlocking");
return -1;
}
printf("File unlocking successfull");
}
return iFile;
}

int main(int argc, char* argv[])
{
char strFilePath []= {"E:\\Add_Modified_ENG\\test.txt"};

char *cFilePath = strFilePath;
int i = LockFile(strFilePath, true);

if(i != -1)
{
ofstream outfile(cFilePath, ios::app);
if(!outfile)
{
cout<<"Unable to open\n";
return 1;
}



outfile<<"Test";

outfile.close();
}

i = LockFile(strFilePath, false);

return 0;

}

Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan

AnswerRe: Unlocking a file.. Pin
Rajkumar R25-Feb-08 17:58
Rajkumar R25-Feb-08 17:58 
GeneralRe: Unlocking a file.. Pin
sharanu25-Feb-08 19:04
sharanu25-Feb-08 19:04 
AnswerRe: Unlocking a file.. Pin
Rajkumar R25-Feb-08 20:31
Rajkumar R25-Feb-08 20:31 
GeneralRe: Unlocking a file.. Pin
sharanu25-Feb-08 20:48
sharanu25-Feb-08 20:48 
AnswerRe: Unlocking a file.. Pin
Rajkumar R25-Feb-08 21:42
Rajkumar R25-Feb-08 21:42 
QuestionHow to change the background color of AfxControlBar*, CToolBar's parent window ? Pin
Paresh Chitte25-Feb-08 17:22
Paresh Chitte25-Feb-08 17:22 
GeneralRe: How to change the background color of AfxControlBar*, CToolBar's parent window ? Pin
SandipG 27-Feb-08 22:46
SandipG 27-Feb-08 22:46 
GeneralRe: How to change the background color of AfxControlBar*, CToolBar's parent window ? Pin
Paresh Chitte28-Feb-08 17:27
Paresh Chitte28-Feb-08 17:27 
Questionhow to generate several Gaussian function according to different sigm Pin
gentleguy25-Feb-08 14:30
gentleguy25-Feb-08 14:30 
QuestionParallel Port Polling Pin
GlenET25-Feb-08 10:21
GlenET25-Feb-08 10:21 
GeneralRe: Parallel Port Polling Pin
Mark Salsbery25-Feb-08 11:04
Mark Salsbery25-Feb-08 11:04 
GeneralRe: Parallel Port Polling Pin
GlenET26-Feb-08 7:21
GlenET26-Feb-08 7:21 
GeneralRe: Parallel Port Polling Pin
Mark Salsbery26-Feb-08 7:51
Mark Salsbery26-Feb-08 7:51 
Generallistview item height Pin
Jim Crafton25-Feb-08 8:19
Jim Crafton25-Feb-08 8:19 
GeneralRe: listview item height Pin
Dr. Emmett Brown25-Feb-08 10:26
Dr. Emmett Brown25-Feb-08 10:26 
GeneralRe: listview item height Pin
David Crow25-Feb-08 11:30
David Crow25-Feb-08 11:30 
GeneralRe: listview item height Pin
Michael Dunn25-Feb-08 12:43
sitebuilderMichael Dunn25-Feb-08 12:43 

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.