2010-05-28 19:13:55 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
2021-10-02 07:13:14 +00:00
|
|
|
#include <base/types.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <IO/ReadHelpers.h>
|
2017-07-12 03:03:56 +00:00
|
|
|
#include <IO/ReadBufferFromFile.h>
|
2010-05-28 19:13:55 +00:00
|
|
|
|
|
|
|
|
2017-12-01 18:36:55 +00:00
|
|
|
int main(int, char **)
|
2010-05-28 19:13:55 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2017-07-12 03:03:56 +00:00
|
|
|
DB::ReadBufferFromFile in("test");
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2024-01-13 02:48:04 +00:00
|
|
|
Int64 a = 0;
|
|
|
|
Float64 b = 0;
|
|
|
|
String c, d;
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2010-05-28 19:13:55 +00:00
|
|
|
size_t i = 0;
|
|
|
|
while (!in.eof())
|
|
|
|
{
|
2010-06-01 13:35:09 +00:00
|
|
|
DB::readIntText(a, in);
|
2010-05-28 19:13:55 +00:00
|
|
|
in.ignore();
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2010-06-01 13:35:09 +00:00
|
|
|
DB::readFloatText(b, in);
|
2010-05-28 19:13:55 +00:00
|
|
|
in.ignore();
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2010-06-01 13:35:09 +00:00
|
|
|
DB::readEscapedString(c, in);
|
2010-05-28 19:13:55 +00:00
|
|
|
in.ignore();
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2010-06-01 13:35:09 +00:00
|
|
|
DB::readQuotedString(d, in);
|
2010-05-28 19:13:55 +00:00
|
|
|
in.ignore();
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2010-05-28 19:13:55 +00:00
|
|
|
++i;
|
|
|
|
}
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2010-05-28 19:13:55 +00:00
|
|
|
std::cout << a << ' ' << b << ' ' << c << '\t' << '\'' << d << '\'' << std::endl;
|
|
|
|
std::cout << i << std::endl;
|
|
|
|
}
|
|
|
|
catch (const DB::Exception & e)
|
|
|
|
{
|
2012-11-08 18:30:49 +00:00
|
|
|
std::cerr << e.what() << ", " << e.displayText() << std::endl;
|
2010-05-28 19:13:55 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2010-05-28 19:13:55 +00:00
|
|
|
return 0;
|
|
|
|
}
|