Click here to Skip to main content
15,889,335 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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.
AnswerRe: Read and Write a same file in FILE Pin
_Flaviu15-May-12 2:53
_Flaviu15-May-12 2:53 
AnswerRe: Read and Write a same file in FILE PinPopular
CPallini15-May-12 2:57
mveCPallini15-May-12 2:57 
AnswerRe: Read and Write a same file in FILE Pin
Richard MacCutchan15-May-12 2:59
mveRichard MacCutchan15-May-12 2:59 
AnswerRe: Read and Write a same file in FILE Pin
Aescleal15-May-12 4:38
Aescleal15-May-12 4:38 
QuestionIn C, how to read data from a file Pin
Baddy_Bad_Boy15-May-12 1:25
Baddy_Bad_Boy15-May-12 1:25 
AnswerRe: In C, how to read data from a file Pin
Richard MacCutchan15-May-12 1:30
mveRichard MacCutchan15-May-12 1:30 
QuestionMultiprocessor sort and search in C? Pin
Simon Langdon14-May-12 23:28
Simon Langdon14-May-12 23:28 
AnswerRe: Multiprocessor sort and search in C? Pin
David Crow15-May-12 3:47
David Crow15-May-12 3:47 
AnswerRe: Multiprocessor sort and search in C? Pin
TomasRiker217-May-12 8:11
TomasRiker217-May-12 8:11 
QuestionMFC help : code error 0000007B Pin
jawadali47714-May-12 21:57
jawadali47714-May-12 21:57 
AnswerRe: MFC help : code error 0000007B Pin
enhzflep14-May-12 22:24
enhzflep14-May-12 22:24 
QuestionRe: MFC help : code error 0000007B Pin
CPallini14-May-12 22:27
mveCPallini14-May-12 22:27 
AnswerRe: MFC help : code error 0000007B Pin
jawadali47714-May-12 23:42
jawadali47714-May-12 23:42 
GeneralRe: MFC help : code error 0000007B Pin
CPallini14-May-12 23:52
mveCPallini14-May-12 23:52 
GeneralRe: MFC help : code error 0000007B Pin
jawadali47716-May-12 19:14
jawadali47716-May-12 19:14 
GeneralRe: MFC help : code error 0000007B Pin
TinyDevices15-May-12 3:32
professionalTinyDevices15-May-12 3:32 
AnswerRe: MFC help : code error 0000007B Pin
Andy41114-May-12 22:49
Andy41114-May-12 22:49 

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.