std::ifstream file("test.cfg");
while (std::getline(file,line)) {
++count;
}
num=rand()%count
file.seekg (0, file.beg);
#include <fstream>
#include <string>
#include <vector>
#include <iostream>
int main()
{
std::ifstream file("test.cfg");
std::vector<std::string> buffer;
std::string line;
while (std::getline(file,line)) {
buffer.push_back(line);
}
std::cout << buffer[rand()%buffer.size()] << std::endl;
system("pause");
return 0;
}