Hello.

I tried to read "/BodyText/Section0" in msole file.
but, an error occurred.
How to read "dir/file" in msole file?


$ valac --pkg libgsf-1 gsf-msole.vala
gsf-msole.vala:27.15-27.55: warning: local variable `body_text'
declared but never used
    Gsf.Input body_text = olefile.child_by_aname(names);
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/cogniti/Documents/gsf-msole.vala.c: In function ‘_vala_main’:
/home/cogniti/Documents/gsf-msole.vala.c:144:2: warning: passing
argument 2 of ‘gsf_infile_child_by_aname’ from incompatible pointer
type [enabled by default]
In file included from /usr/include/libgsf-1/gsf/gsf-infile-impl.h:27:0,
                 from /home/cogniti/Documents/gsf-msole.vala.c:13:
/usr/include/libgsf-1/gsf/gsf-infile.h:42:13: note: expected ‘const
char **’ but argument is of type ‘gchar **’
/home/cogniti/Documents/gsf-msole.vala.c:144:2: error: too many
arguments to function ‘gsf_infile_child_by_aname’
In file included from /usr/include/libgsf-1/gsf/gsf-infile-impl.h:27:0,
                 from /home/cogniti/Documents/gsf-msole.vala.c:13:
/usr/include/libgsf-1/gsf/gsf-infile.h:42:13: note: declared here
error: cc exited with status 256
Compilation failed: 1 error(s), 1 warning(s)



The ole file structure is
    root/
    root/PrvText
    root/DocOptions
    root/DocOptions/_LinkDoc
    root/DocInfo
    root/?HwpSummaryInformation
    root/PrvImage
    root/FileHeader
    root/Scripts
    root/Scripts/DefaultJScript
    root/Scripts/JScriptVersion
    root/BodyText
    root/BodyText/Section0


gsf-msole.vala:

int main (string[] args) {

    // declare objects
    Gsf.InputStdio file;
    Gsf.InfileMSOle olefile;

    string filename = args[1];
    // load the OLE file
    try {
        file = new Gsf.InputStdio (filename);
    }
    catch {
        stderr.printf ("File %s not found\n", filename);
        return 1;
    }
    try {
        olefile = new Gsf.InfileMSOle (file);
    }
    catch
    {
        stderr.printf ("%s is not a OLE file\n", filename);
        return 1;
    }

    string[] names = {"BodyText", "Section0"};
    // compile error occurred
    Gsf.Input body_text = olefile.child_by_aname(names);
    return 0;
}
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to