/*
*
* File: pdf-disk.c
* Date: Mon Jan 19 14:19:42 2009
*
*/
/* Copyright (C) 2008 Free Software Foundation, Inc. */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#include
#include
#include
#include
#include
#ifdef HAVE_MALLOC_H
#include
#else
#include
#endif /* HAVE_MALLOC_H */
#include
#include
#include
int
main (int argc, char *argv[])
{
pdf_text_t filepath = NULL;
pdf_fsys_file_t file = NULL;
const pdf_char_t *utf8_path = "/tmp/pdf.txt";
pdf_text_init();
if(pdf_text_new_from_unicode(utf8_path, strlen(utf8_path), PDF_TEXT_UTF8, &filepath) != PDF_OK)
{
printf("new_from_unicode error\n");
return -1;
}
if(pdf_fsys_item_p(NULL, filepath) == PDF_TRUE)
{
printf("file exists!!\n");
}
else
{
printf("file DOESN'T exist!!\n");
return -2;
}
if(pdf_fsys_file_open(NULL, filepath, PDF_FSYS_OPEN_MODE_READ, &file) != PDF_OK)
{
printf("error opening file\n");
return -3;
}
if(pdf_fsys_file_close(file) != PDF_OK)
{
printf("error closing file\n");
return -4;
}
pdf_text_destroy(filepath);
printf("ALL OK\n");
return 0;
}
/* End of pdf-disk.c */