int QccChannelWriteWholefile(QccChannel
*channel);
int QccChannelWriteHeader(QccChannel *channel);
int QccChannelStartWrite(QccChannel
*channel);
int QccChannelEndWrite(QccChannel *channel);
int QccChannelWriteBlock(QccChannel
*channel);
QccChannelWriteWholefile() writes the CHN-format file whose filename is given by channel->filename. The whole file, including the header and all symbols of the channel, is written at once. channel->channel_symbols is assumed to be allocated and to contain all channel -> channel_length symbols of the channel.
QccChannelWriteHeader() writes header information to the CHN-format file pointed to by channel->fileptr, which must be already open for writing and positioned at the start of the file. The magic number and version information is supplied automatically by QccFileWriteMagicNumber(3) .
QccChannelStartWrite() must be called before any block-based write to channel. QccChannelStartWrite() opens the file with QccFileOpen(3) and writes the file's header with QccChannelWriteHeader(3) . If the symbol array is not already allocated (i.e., if channel->channel_symbols is NULL) the symbol array is allocated by calling QccChannelAlloc(3) . Prior to calling QccChannelStartWrite(), channel->filename must contain the name of the file, channel->alphabet_size must contain the channel alphabet size, channel->channel_length must contain the total length of the channel, and channel->access_block_size must give the block size desired for subsequent block-based writes. After QccChannelStartWrite() returns, channel->fileptr contains the FILE pointer to the open file, and the file is positioned immediately after the header, ready for writing the first block of symbols.
QccChannelEndWrite() closes a channel file opened by a previous call to QccChannelStartWrite(); additionally, the symbol array, channel->channel_symbols, is freed with a call to QccChannelFree(3) .
QccChannelWriteBlock() writes the next block of symbols in the channel. channel must be prepared by a prior call to QccChannelStartWrite(); that is, channel->fileptr must point to an open file and channel->access_block_size must contain the size of the block of symbols to write. Additionally, channel->channel_symbols must contain the block of symbols to be written. QccChannelWriteBlock() writes non-overlapping blocks of data to the file; after QccChannelWriteBlock() returns, the file is positioned to write the subsequent block.