I`m trying to take a name and 3 numbers from a text file then take that input and store the name into color and the 3 numbers into r,g,b then it will take the r,g,b numbers and turn them into hex color codes.the text file format is as follows
color1 190 190 190
color2 20 50 70
This following code is where my problem lies
ifstream ReadFile;
ReadFile.open(filename);
if(ReadFile.fail())
{
cout<<"Could not open "<<filename<<endl;
}
else
{
while ( getline (ReadFile,line) )
{
cout << line << '\n';
}
}
//for(string line; getline(ReadFile, line, '.'); )
//{
//cout<<line<<endl;
//}
ReadFile.close();
//cout<<"Enter the value of RGB(from range 0 to 255):";
cin>>r>>g>>b;
cout<<rgbtohex(r,b,g,true)<<endl;