I have a file, it's on WebDAV server. I want to edit this file using neon WebDAV client library on C. What I want is - open this file in a default app for it's MIME type, and after I'll finish editing, it should save all changes on webdav server. My OS is Windows 7.
I have some questions.
- Should I download this file to temp directory first?
- Is there any neon command to do it?
- How can I know if file was changed?
- Is there any way to check if "save" button was clicked?
- When I'll make some changes in file, what command should I use to commit this changes to webdav server?
If someone has simple example, please, share it with me.
Update
Thank you again, and sorry for this "answer" issue. I've tried to use following code:
do {
fd = open("c:\\temp\\testdoc.docx", O_CREAT | O_RDWR, _S_IREAD | _S_IWRITE);
} while (fd == -1 && errno == EINTR);
if (fd == -1) {
const char *const errmsg = strerror(errno);
fprintf(stderr, "%s: %s.\n", "c:\\temp\\testdoc.docx", errmsg);
exit(1);
}
res =ne_get(sess, "/webdav/test/testdoc.docx", fd);
_close(fd);
But I'm still getting "We're sorry. We can't open testdoc.docx because we found a problem with it's contents" when i'm trying to open it with MS Word. Wern i'm downloading this file directly from my server, without using neon, this file has same size as file which was downloaded using ne_get command, and MS Office opens it perfectly.
Also, i've tried to create testdoc.docx using MS Word, and put it into my server, using following code:
do {
fd = open("c:\\temp\\testdoc.docx", O_CREAT | O_RDWR, _S_IREAD | _S_IWRITE);
} while (fd == -1 && errno == EINTR);
if (fd == -1) {
const char *const errmsg = strerror(errno);
fprintf(stderr, "%s: %s.\n", "c:\\temp\\testdoc.docx", errmsg);
exit(1);
}
res =ne_put(sess, "/webdav/test/testdoc.docx", fd);
_close(fd);
But res is 1 and error is: "Premature EOF in request body file".