New file natives...
Well Emp has gotten me this far with new file natives, but we are having a problem getting the semi-colon to the beginning of the line. Currently it is just added to the end of the line. Code:
#include <amxmodx> |
Re: New file natives...
Trying using ftell before you read in the line (and cache the result), read the line in, add your ;, then use fseek to go back to the cached position and write there?
|
Re: New file natives...
instead of using fputs which will just add to the line that is already there try this..
Code:
new msg[256] |
Re: New file natives...
Quote:
|
Re: New file natives...
Quote:
Slmclarengt |
Re: New file natives...
AFAIK the old file natives open a file, seek to the file you specified do the read/write and then close the file. Sequentially reading to find the line you want is a slow task..
Try using ftell and fseek to overwrite a line (I've never tried it but I think it might work), but I think i've read somewhere that the only way to do this is to create a backup file and sequentially copy lines from the file into the backup. When you reach the file you want to modify do the modification and copy that across. Once you reach the end of the file, delete it and rename the backup to the original name. |
Re: New file natives...
Change this to fit your needs.
Note: If you don't need the line number ther you should use fread_blocks() and fwrite_blocks() instead. |
| All times are GMT -4. The time now is 10:38. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.