Click here to Skip to main content
15,902,445 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CFile Open failed GetLastError = 3 Pin
Richard MacCutchan16-May-12 4:03
mveRichard MacCutchan16-May-12 4:03 
GeneralRe: CFile Open failed GetLastError = 3 Pin
yu-jian16-May-12 4:09
yu-jian16-May-12 4:09 
GeneralRe: CFile Open failed GetLastError = 3 Pin
yu-jian16-May-12 4:13
yu-jian16-May-12 4:13 
QuestionRe: CFile Open failed GetLastError = 3 Pin
enhzflep16-May-12 4:21
enhzflep16-May-12 4:21 
GeneralRe: CFile Open failed GetLastError = 3 Pin
Richard MacCutchan16-May-12 4:29
mveRichard MacCutchan16-May-12 4:29 
GeneralRe: CFile Open failed GetLastError = 3 Pin
yu-jian16-May-12 5:20
yu-jian16-May-12 5:20 
GeneralRe: CFile Open failed GetLastError = 3 Pin
Richard Andrew x6416-May-12 5:54
professionalRichard Andrew x6416-May-12 5:54 
GeneralRe: CFile Open failed GetLastError = 3 Pin
Richard MacCutchan16-May-12 7:54
mveRichard MacCutchan16-May-12 7:54 
GeneralRe: CFile Open failed GetLastError = 3 Pin
yu-jian16-May-12 15:07
yu-jian16-May-12 15:07 
GeneralRe: CFile Open failed GetLastError = 3 Pin
CPallini16-May-12 6:55
mveCPallini16-May-12 6:55 
GeneralRe: CFile Open failed GetLastError = 3 Pin
Richard MacCutchan16-May-12 7:55
mveRichard MacCutchan16-May-12 7:55 
QuestionHow to Define Horizontal profile ? c++ Pin
Pixel8615-May-12 16:35
Pixel8615-May-12 16:35 
AnswerRe: How to Define Horizontal profile ? c++ Pin
enhzflep15-May-12 20:08
enhzflep15-May-12 20:08 
Questionunreadable content written by fwrite() Pin
dilipkumarc15-May-12 5:46
dilipkumarc15-May-12 5:46 
AnswerRe: unreadable content written by fwrite() Pin
Richard MacCutchan15-May-12 6:29
mveRichard MacCutchan15-May-12 6:29 
AnswerRe: unreadable content written by fwrite() Pin
David Crow15-May-12 6:34
David Crow15-May-12 6:34 
AnswerRe: unreadable content written by fwrite() Pin
Andy41115-May-12 23:44
Andy41115-May-12 23:44 
QuestionUSB CreateFile() Access is denied Pin
__John_15-May-12 3:58
__John_15-May-12 3:58 
GeneralRe: USB CreateFile() Access is denied Pin
David Crow15-May-12 4:01
David Crow15-May-12 4:01 
GeneralRe: USB CreateFile() Access is denied Pin
__John_15-May-12 4:23
__John_15-May-12 4:23 
QuestionCreate BMP of 8bpp Pin
john563215-May-12 3:41
john563215-May-12 3:41 
AnswerRe: Create BMP of 8bpp Pin
Chris Losinger15-May-12 4:33
professionalChris Losinger15-May-12 4:33 
GeneralMessage Removed Pin
15-May-12 21:41
john563215-May-12 21:41 
GeneralRe: Create BMP of 8bpp Pin
enhzflep15-May-12 23:30
enhzflep15-May-12 23:30 
QuestionRead and Write a same file in FILE Pin
D.Manivelan15-May-12 2:29
D.Manivelan15-May-12 2:29 
Hi,
I want to read line from a file and after reading that line i have to delete that line.I think deleting a line in file is difficult.So i thought to replace the line with null string.
For that i coded below..first i test with text "TEST" for updating.But i could not get that.

if ( (fpExe=fopen((LPCTSTR)sExePath, "r+"))!=NULL)
	{							
		while(fgets(List,80,fpExe)!=NULL)
		{
		sReadLine = List;	
		off1 = ftell(fpExe);
		result = fseek( fpExe, off1,SEEK_SET);
		fprintf( fpExe, "%s", "TEST" );

					}
		fclose(fpExe);	
		return false;
	}
	else
	{
		return false;
	}


Example:
INSTRUCTOR1
INSTRUCTOR2
this should become
TEST
TEST

But actually what comes as
INSTRUCTOR1
TESTRUCTOR1

So how can i replace string with null or another string.

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.