Reading comma delimited values with CFile?

  • Thread starter Thread starter ungvichian
  • Start date Start date
U

ungvichian

So, right now I'm writing a program in VC++.Net with MFC, and one of
the steps involves reading numeric values from a comma delimited file
(like 4.56, 2.44, 3.453 etc.). The only methods I've been able to find
to read the values all involve StreamReader, and I can't figure out how
to use this. Since I'm using MFC, I'm using CFile instead.

Also, none of the methods seem to come with a method for error
catching. I want my program to be able to reject files that are NOT
comma delimited numbers with an error message.

Okay, how to code?
 
ungvichian said:
So, right now I'm writing a program in VC++.Net with MFC, and one of
the steps involves reading numeric values from a comma delimited file
(like 4.56, 2.44, 3.453 etc.). The only methods I've been able to find
to read the values all involve StreamReader, and I can't figure out how
to use this. Since I'm using MFC, I'm using CFile instead.

Also, none of the methods seem to come with a method for error
catching. I want my program to be able to reject files that are NOT
comma delimited numbers with an error message.

Okay, how to code?

Why don't you read the file into a string and then split by coma?
 
Back
Top