hlmod.hu
https://hlmod.hu/

String kiolvasása fájlból
https://hlmod.hu/viewtopic.php?f=9&t=26581
Oldal: 1 / 1

Szerző:  Krisznitro [ 2016.11.03. 16:53 ]
Hozzászólás témája:  String kiolvasása fájlból

Hali!
Egy változóba ( g_szKod[id] ) kellene menteni a kiolvasott szövegeket ebből a részből, mforce adta még régebbi témámból. Szóval az g_szKod[id]-t kellene lementeni STRING-ként. Előre is köszönöm.

  1. public plugin_cfg() {
  2.     new szLine[64], szFileName[128], iFilePointer;
  3.     get_localinfo("amxx_configsdir", szFileName, charsmax(szFileName));
  4.     add(szFileName, charsmax(szFileName), "/szavak.ini");
  5.    
  6.     iFilePointer = fopen(szFileName, "rt");
  7.     if(!iFilePointer) set_fail_state("A fajl nem talalhato.");
  8.    
  9.     new szKey[32];
  10.     while(!feof(iFilePointer)) {
  11.         fgets(iFilePointer, szLine, charsmax(szLine)); trim(szLine);
  12.         if(!szLine[0] || szLine[0] == ';' || szLine[0] == '#') continue;
  13.  
  14.         if(parse(szLine, szKey, charsmax(szKey))) {
  15.         // ide jön a mentés
  16.         }
  17.     }
  18.  
  19.     fclose(iFilePointer);
  20. }

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/