Mercurial > mercurial > hgweb_xdwtools.cgi
view xdw2txt.cpp @ 4:af8f454d20ed
add xdwsplit2.
author | pyon@macmini |
---|---|
date | Fri, 27 Oct 2017 01:48:00 +0900 (2017-10-26) |
parents | c1ebc8b218f2 |
children |
line wrap: on
line source
/* xdwapi�̃T���v��2 �@�\: DocuWorks�������̃e�L�X�g�����e�L�X�g�t�@�C���ɏo�͂��� �g�p���@: xdw2txt �����t�@�C���� �ۑ���e�L�X�g�t�@�C���� */ #include <stdio.h> #include <stdlib.h> #include <io.h> #include <windows.h> #include <xdw_api.h> void print_error(int code) { switch (code) { case XDW_E_NOT_INSTALLED: fprintf(stderr, "DocuWorks���C���X�g�[������Ă��܂���B"); break; case XDW_E_FILE_NOT_FOUND: fprintf(stderr, "�w�肳�ꂽ�t�@�C����������܂���B"); break; case XDW_E_FILE_EXISTS: fprintf(stderr, "�w�肳�ꂽ�t�@�C���͂��łɑ��݂��܂��B"); break; case XDW_E_ACCESSDENIED: case XDW_E_INVALID_NAME: case XDW_E_BAD_NETPATH: fprintf(stderr, "�w�肳�ꂽ�t�@�C�����J�����Ƃ��ł��܂���B"); break; case XDW_E_BAD_FORMAT: fprintf(stderr, "�w�肳�ꂽ�t�@�C���͐������t�H�[�}�b�g�ł͂���܂���B"); break; case XDW_E_INVALID_ACCESS: fprintf(stderr, "�w�肳�ꂽ��������錠��������܂���B"); break; default: fprintf(stderr, "�G���[���������܂����B"); break; } } int main(int argc, char** argv) { int api_result = 0; if ( argc != 3) { fprintf(stderr, "�g�p���@: xdw2txt �����t�@�C���� �ۑ���e�L�X�g�t�@�C����"); return 0; } char in_path[_MAX_PATH], out_path[_MAX_PATH]; _fullpath(in_path, argv[1], _MAX_PATH); _fullpath(out_path, argv[2], _MAX_PATH); int page = 0; // �����n���h�����J�� XDW_DOCUMENT_HANDLE h = NULL; XDW_OPEN_MODE_EX mode = { sizeof(XDW_OPEN_MODE_EX), XDW_OPEN_READONLY, XDW_AUTH_NODIALOGUE }; api_result = XDW_OpenDocumentHandle(in_path, &h, (XDW_OPEN_MODE*)&mode); if (api_result < 0) { print_error(api_result); return 0; } api_result = XDW_GetFullText(h, out_path, NULL); if (api_result < 0) print_error(api_result); // �����n���h������� XDW_CloseDocumentHandle(h, NULL); return (api_result >= 0); }