Raised This Month: $ Target: $400
 0% 

replacing a whole line in a file with nothing


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-06-2007 , 20:24   replacing a whole line in a file with nothing
Reply With Quote #1

EDIT:
New question.
Lets say I have line text wich equals "^r". I want to replace this with "" meaning i would like to delete the line, would this be possible? i've tryed fprintf and fputs but I'm not really getting anywhere with it... everytime it prints at the end of the file.

I would like doing this with the new file natives and without creating a temp file.

Current Code:
Code:
stock test() {         new data[64], fileh = fopen("addons/amxmodx/test.txt", "r+");         if ( ! fileh )         return         while ( ! feof(fileh) ) {                 fgets(fileh, data, 63);                 if ( equal(data, "^n") ) {             // ?             // fprintf(fileh, "") neither of these             // fputs(fileh, "") worked well         }             }         fclose(fileh)     }

Last edited by [ --<-@ ] Black Rose; 01-07-2007 at 11:30.
[ --<-@ ] Black Rose is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode