Example #1
0
int embPattern_write(EmbPattern* p, const char *fileName) /* TODO: Write test case using this convenience function. */
{
    EmbReaderWriter* writer = 0;
    writer = embReaderWriter_getByFileName(fileName);
    if(writer->writer(p, fileName))
    {
        free(writer);
        return 1;
    }
    free(writer);
    return 0;
}
Example #2
0
/*! Writes the data from \a pattern to a file with the given \a fileName.
 *  Returns \c true if successful, otherwise returns \c false. */
int embPattern_write(EmbPattern* pattern, const char* fileName) /* TODO: Write test case using this convenience function. */
{
    EmbReaderWriter* writer = 0;
    int result = 0;

    if(!pattern) { embLog_error("emb-pattern.c embPattern_write(), pattern argument is null\n"); return 0; }
    if(!fileName) { embLog_error("emb-pattern.c embPattern_write(), fileName argument is null\n"); return 0; }

    writer = embReaderWriter_getByFileName(fileName);
    if(!writer) { embLog_error("emb-pattern.c embPattern_write(), unsupported write file type: %s\n", fileName); return 0; }
    result = writer->writer(pattern, fileName);
    free(writer);
    writer = 0;
    return result;
}