View Single Post
Hennesy
Member
Join Date: Nov 2018
Location: Czech Republic
Old 08-16-2021 , 16:40   Re: Reading and displaying information from a file
Reply With Quote #3

Quote:
Originally Posted by pr0mers View Post
Code:
new String:g_sFilePath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, g_sFilePath, sizeof(g_sFilePath), "configs/rules.txt"); // this is the csgo/addons/sourcemod/configs/rules.txt
new Handle:fileHandle = OpenFile( g_sFilePath, "r" );
decl String:fileLine[256];
while( !IsEndOfFile( fileHandle ) && ReadFileLine( fileHandle, fileLine, sizeof( fileLine ) ) )
{
     TrimString( fileLine );
     PrintToChatAll(fileLine);
}
CloseHandle( fileHandle );
should do the trick
need new syntax.

PHP Code:
    static char g_sFilePath[PLATFORM_MAX_PATH], fileLine[256];
    
BuildPath(Path_SMg_sFilePathsizeof(g_sFilePath), "configs/rules.txt");
    
Handle fileHandle OpenFileg_sFilePath"r" );

    while(!
IsEndOfFile(fileHandle) && ReadFileLine(fileHandlefileLinesizeof(fileLine)))
    {
        
TrimString(fileLine);
        
PrintToChatAll(fileLine);
    }

    
delete fileHandle
I'll go check
__________________
I'm sorry for my english

Last edited by Hennesy; 08-16-2021 at 16:42.
Hennesy is offline