test001.c

#include <ntar.h>

int main()
{
    ntar_file_handle *file_handle;
    int ret_value;

    ret_value = ntar_open("test001.ntar","w",&file_handle);

    if (ret_value == NTAR_SUCCESS)
    {
        ntar_section_handle *section_handle;

        fprintf(stderr, "File created\n");
        
        ret_value = ntar_create_section(file_handle, &section_handle);

        if (ret_value == NTAR_SUCCESS)
        {
            fprintf(stderr,"Section opened\n");
            
            ret_value = ntar_close_section(section_handle);
    
            if (ret_value == NTAR_SUCCESS)
                fprintf(stderr,"Section closed\n");
            else
                fprintf(stderr,"ERROR closing section: %d\n", ret_value);
        }
        else
            fprintf(stderr,"ERROR creating section: %d\n", ret_value);

        ret_value = ntar_close(file_handle);

        if (ret_value == NTAR_SUCCESS)
            fprintf(stderr,"File closed\n");
        else
            fprintf(stderr,"ERROR closing file: %d\n", ret_value);
    }
    else
        fprintf(stderr,"ERROR creating file: %d\n", ret_value);
    return 0;
}

NTAR documentation. Copyright (c) 2004 - 2005 Condor Engineering, Inc. All rights reserved.