| 1 | #include <string> |
|---|---|
| 2 | |
| 3 | #include <iostream> |
| 4 | #include <fstream> |
| 5 | |
| 6 | #include <Core/Types.h> |
| 7 | #include <IO/ReadHelpers.h> |
| 8 | #include <IO/ReadBufferFromFile.h> |
| 9 | |
| 10 | |
| 11 | int main(int, char **) |
| 12 | { |
| 13 | try |
| 14 | { |
| 15 | DB::ReadBufferFromFile in("test"); |
| 16 | |
| 17 | DB::Int64 a = 0; |
| 18 | DB::Float64 b = 0; |
| 19 | DB::String c, d; |
| 20 | |
| 21 | size_t i = 0; |
| 22 | while (!in.eof()) |
| 23 | { |
| 24 | DB::readIntText(a, in); |
| 25 | in.ignore(); |
| 26 | |
| 27 | DB::readFloatText(b, in); |
| 28 | in.ignore(); |
| 29 | |
| 30 | DB::readEscapedString(c, in); |
| 31 | in.ignore(); |
| 32 | |
| 33 | DB::readQuotedString(d, in); |
| 34 | in.ignore(); |
| 35 | |
| 36 | ++i; |
| 37 | } |
| 38 | |
| 39 | std::cout << a << ' ' << b << ' ' << c << '\t' << '\'' << d << '\'' << std::endl; |
| 40 | std::cout << i << std::endl; |
| 41 | } |
| 42 | catch (const DB::Exception & e) |
| 43 | { |
| 44 | std::cerr << e.what() << ", "<< e.displayText() << std::endl; |
| 45 | return 1; |
| 46 | } |
| 47 | |
| 48 | return 0; |
| 49 | } |
| 50 |