mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-13 19:14:30 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
42 lines
881 B
C++
42 lines
881 B
C++
#include <string>
|
|
|
|
#include <IO/ReadBufferFromFileDescriptor.h>
|
|
#include <IO/LimitReadBuffer.h>
|
|
#include <IO/WriteBufferFromFileDescriptor.h>
|
|
#include <IO/copyData.h>
|
|
#include <IO/WriteHelpers.h>
|
|
|
|
|
|
int main(int argc, char ** argv)
|
|
{
|
|
using namespace DB;
|
|
|
|
if (argc < 2)
|
|
{
|
|
std::cerr << "Usage: program limit < in > out\n";
|
|
return 1;
|
|
}
|
|
|
|
UInt64 limit = std::stol(argv[1]);
|
|
|
|
ReadBufferFromFileDescriptor in(STDIN_FILENO);
|
|
WriteBufferFromFileDescriptor out(STDOUT_FILENO);
|
|
|
|
writeCString("--- first ---\n", out);
|
|
{
|
|
LimitReadBuffer limit_in(in, limit, false);
|
|
copyData(limit_in, out);
|
|
}
|
|
|
|
writeCString("\n--- second ---\n", out);
|
|
{
|
|
LimitReadBuffer limit_in(in, limit, false);
|
|
copyData(limit_in, out);
|
|
}
|
|
|
|
writeCString("\n--- the rest ---\n", out);
|
|
copyData(in, out);
|
|
|
|
return 0;
|
|
}
|