"Moonlit" <news moonlit xs4all nl> wrote in message
| Hi,
|
|
| Unless you know excell's format it probably is easier to save the
excell
| sheet as csv file and then do something like this
|
#include <iostream>
#include <ostream>
| #include <ifstream>
| #include <string>
| #include <sstream>
#include <stdexcept>
|
| using namespace std;
|
| int main()
| {
| int RetVal = 0;
|
| try
| {
| ifstream Input( "excell.csv" );
if(!Input)
{
throw std::exception("while opening file\n");
}
| // Testing if open etc.
| string Line Name, Surname;
| while( getline( Input, Line ) )
| {
| replace_if( Line.begin(), Line.end(), bind2nd(
equal_to<char>(), | ';' ),
| ' ' );
| stringstream Tokens( Line );
| Tokens >> Name >> Surname;
| }
if ( !Input.eof() )
{
throw std::exception("while parsing data.\n");
}
| }
catch(const std::exception& e)
{
std::cout << "Error: \n";
std::cout << e.what() << std::endl;
}
| catch( ...)
| {
| RetVal = -1;
| }
| return RetVal;
catch(...)
{
std::cout << "Error: unexpected exception caught!\n";
}
return 0;
| }
|
|
| --
|
|
| Regards, Ron AF Greve
|
|
http://moonlit.xs4all.nl
|
| | >i have datas in an excel file like this:
| > names surnames
| > jack white
| > smith black
| > marry brown
| >
| > how can i read these datas for ex i know that names in the cell A1
and
| > surnames is next to it?
| >
|
|