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

C / C++ / MFC

 
GeneralRe: caveats when using _malloc_dbg Pin
peterchen17-Dec-04 23:09
peterchen17-Dec-04 23:09 
GeneralRe: caveats when using _malloc_dbg Pin
ThatsAlok18-Dec-04 0:01
ThatsAlok18-Dec-04 0:01 
GeneralAlt+Tab replacement Pin
User 665817-Dec-04 4:50
User 665817-Dec-04 4:50 
GeneralRe: Alt+Tab replacement Pin
Alex Korchemniy17-Dec-04 13:14
Alex Korchemniy17-Dec-04 13:14 
GeneralRe: Alt+Tab replacement Pin
User 665817-Dec-04 14:29
User 665817-Dec-04 14:29 
GeneralRe: Howto update text files Pin
yarp17-Dec-04 3:57
yarp17-Dec-04 3:57 
GeneralRe: Howto update text files Pin
John R. Shaw17-Dec-04 4:59
John R. Shaw17-Dec-04 4:59 
GeneralHowto update text files Pin
yarp17-Dec-04 3:28
yarp17-Dec-04 3:28 
I'm trying to update a text file by overwritting a part of the text in the middle of the file. I'm using the fwrite function.
I manage to overwrite something unfortunately the new text overlaps the text of the contiguous line when it is longer than previous text.

For example:
My first line
Line to override
My next line

Gives:
My first line
Overriden line which is longer
ext line

I wonder if it is possible to insert longer than previous line text with fwrite and if so how to do, if not how to do Wink | ;)

I don't have the code here but it is something like the folowing (assuming you are reading line 2 only):
<br />
fFile = fopen("myfile.txt", "r+");<br />
...<br />
fgets(pBuffer)) {<br />
ftell();<br />
fWrite("new text");<br />
fflush(fFile)<br />
...<br />
}<br />
fclose(fFile);<br />

Sorry for the code, if you want more I can post it later.

Yarp
http://www.senosoft.com/
GeneralRe: Howto update text files Pin
Prakash Nadar17-Dec-04 3:46
Prakash Nadar17-Dec-04 3:46 
GeneralWhen &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
Member 159648417-Dec-04 2:32
Member 159648417-Dec-04 2:32 
GeneralRe: When &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
John R. Shaw17-Dec-04 4:19
John R. Shaw17-Dec-04 4:19 
GeneralRe: When &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
Member 159648417-Dec-04 4:37
Member 159648417-Dec-04 4:37 
GeneralRe: When &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
John R. Shaw17-Dec-04 4:46
John R. Shaw17-Dec-04 4:46 
GeneralRe: When &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
Member 159648417-Dec-04 12:57
Member 159648417-Dec-04 12:57 
GeneralRe: When &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
John R. Shaw17-Dec-04 14:06
John R. Shaw17-Dec-04 14:06 
GeneralRe: When &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
Antony M Kancidrowski17-Dec-04 4:53
Antony M Kancidrowski17-Dec-04 4:53 
GeneralRe: When &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
John R. Shaw17-Dec-04 5:44
John R. Shaw17-Dec-04 5:44 
GeneralRe: When &quot;function pointer&quot; meets &quot;template&quot;... I can't get rid of this compiling error !!! Pin
Anonymous17-Dec-04 6:52
Anonymous17-Dec-04 6:52 
Generalchange caption font of dialog for XP Pin
includeh1017-Dec-04 2:08
includeh1017-Dec-04 2:08 
GeneralRe: change caption font of dialog for XP Pin
Prakash Nadar17-Dec-04 4:32
Prakash Nadar17-Dec-04 4:32 
GeneralRe: change caption font of dialog for XP Pin
ThatsAlok17-Dec-04 22:43
ThatsAlok17-Dec-04 22:43 
Generalmethod for determining full application path Pin
scoroop17-Dec-04 2:01
scoroop17-Dec-04 2:01 
GeneralRe: method for determining full application path Pin
krmed17-Dec-04 2:17
krmed17-Dec-04 2:17 
GeneralRe: method for determining full application path Pin
Antony M Kancidrowski17-Dec-04 3:08
Antony M Kancidrowski17-Dec-04 3:08 
GeneralRe: method for determining full application path Pin
scoroop17-Dec-04 4:53
scoroop17-Dec-04 4:53 

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.