Function
streamReadBlock
Read a block of bytes into a buffer.
streamReadBlock(target, stream, maxLen)
Include Headers
seqan/stream.h
Parameters
target
The buffer to read into. There has to be enough space for maxLen bytes.
Types: char *
stream
The stream to read from.
maxLen
maximal number of characters to read.
Types: size_t
Return Values
Number of read bytes.
Examples
Copying data from a std::fstream into another std::fstream using SeqAn's stream adaption.
#include <fstream>
#include <seqan/sequence.h>
#include <seqan/stream.h>
 
int main()
{
    std::fstream in("in.txt", std::ios::binary | std::ios::in);
    std::fstream out("out.txt", std::ios::binary | std::ios::in);
 
    seqan::CharString buffer;
    resize(buffer, 1000);
 
    while (!seqan::atEnd(in) && seqan::streamError(in) == 0)
    {
        int num = seqan::streamReadBlock(&buffer[0], in, length(buffer));
        seqan::streamWriteBlock(out, &buffer[0], num);
    }
 
    return 0;
}
Part of Concept
SeqAn - Sequence Analysis Library - www.seqan.de
 

Page built @2013/07/11 09:12:18