SA-MP Forums Archive
[Tool/Web/Other] [C++] SampFavorites - C++ class for working with SA-MP favorites list (USERDATA.DAT) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Tools and Files (https://sampforum.blast.hk/forumdisplay.php?fid=82)
+---- Thread: [Tool/Web/Other] [C++] SampFavorites - C++ class for working with SA-MP favorites list (USERDATA.DAT) (/showthread.php?tid=622847)



[C++] SampFavorites - C++ class for working with SA-MP favorites list (USERDATA.DAT) - ZiGGi - 27.11.2016

SampFavorites
GitHub
About
C++ class for working with SA-MP favorites list (USERDATA.DAT).

Usage
The example of usage this class:
PHP Code:
#include <iostream>
#include "SampFavorites.hpp"
int main()
{
    
SampFavorites data;
    
data.open("USERDATA.DAT");
    if (!
data.isOpen()) {
        
std::cout << "Error reading file" << std::endl;
        return 
1;
    }
    
SampFavorites::Header header;
    
SampFavorites::Server server;
    
header data.getHeader();
    
std::cout << header.fileTag << "\n"
              
<< header.fileVersion << "\n"
              
<< header.serversCount << "\n";
    for (
int i 0header.serversCounti++) {
        
server data.getServer(i);
        
std::cout << server.address << " | "
                  
<< server.port << " | "
                  
<< server.hostname << " | "
                  
<< server.password << " | "
                  
<< server.rcon << std::endl;
    }
    
server.address = (char *)"999.000.111.32";
    
server.port 4322;
    
server.hostname = (char *)"test host";
    
server.password = (char *)"pass22";
    
server.rcon = (char *)"rcon1";
    
data.addServer(server);
    
data.save("test.dat");
    return 
0;

Download
- GitHub download page: https://github.com/Open-GTO/SampFavorites/releases


Re: [C++] SampFavorites - C++ class for working with SA-MP favorites list (USERDATA.DAT) - SyS - 27.11.2016

Simple but nice effort.