Raised This Month: $ Target: $400
 0% 

C file natives


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
FatalisDK
Senior Member
Join Date: Mar 2006
Location: bacon
Old 10-22-2006 , 19:41   C file natives
Reply With Quote #1

I want to convert this to the C file natives (fopen, fseek, fgets, etc)
And yes, I know this plugin doesnt handle any errors, it's just a rough draft.

Code:
#include <amxmodx> #define PLUGIN "New Plugin" #define VERSION "0.1" #define AUTHOR "FatalisDK" new const gFILE[] = "test.txt"; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR);     test(); } test() {     //Display last 10 lines of file - File is always greater than 10 lines     //How would I do this using the C file natives? (or whatever you call them)         new lines = file_size(gFILE, 1);     new szData[3], txtLen         for( new i = lines-10; i < lines; i++ )     {                 read_file(gFILE, i, szData, 2, txtLen);         server_print("%i = %s", i, szData);     } }
__________________
FatalisDK 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 04:52.


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