I need help first finding the exact point size from the input file I'm reading in through command line, so that's what the int extractPointSize() function is used for. This is currently what my code looks like, if you could help me extract the point size, which is the number in the input file, that'd help greatly.
Misc-Crackling-medium-r-normal 12 This is a short line.
misc-Futura Poster-light-r-normal 24 THIS IS A LONGER, MORE EXPENSIVE LINE.
misc-cmr10-medium-r-normal 10 This is cheap.
[code]int main(int argc, char *argv[])
{
// all variables declared
ifstream fin; // reading in the file
ofstream fout; // reading out the file
int cost[256] = { 0 }; //cost array
char openfile[MAX_FILE]; //opening file array
char fontLine[500] = { 0 }; //font line array
//checks to see if user input is matching to format needed
if (argc != 2)
{
cout << "Incorrect input, program4 data.in" << endl;
}
strcpy(openfile, argv[argc - 1]);
//opens file and checks to see if it was opened or not
fin.open(openfile);
if (!fin)
{
cout << "Unable to open the file: data.in" << endl;
fin.close();
return -1;
}
}
int extractPointSize(string input)
{
int Size = 0;
string Temp;
for (size_t i = 0; i < input.length(); ++i)
{
if (isdigit(input[i]))
{
if (isspace(input[i - 1]))
{
Temp = input.substr(i, string::npos);
Size = strtoul(Temp.c_str(), NULL, 0);
I need help first finding the exact point size from the input file I'm reading in through command line, so that's what the int extractPointSize() function is used for. This is currently what my code looks like, if you could help me extract the point size, which is the number in the input file, that'd help greatly.
Misc-Crackling-medium-r-normal 12 This is a short line.
misc-Futura Poster-light-r-normal 24 THIS IS A LONGER, MORE EXPENSIVE LINE.
misc-cmr10-medium-r-normal 10 This is cheap.