6 #include <libsmbclient.h>
7 #include "get_auth_data_fn.h"
10 int main(int argc, char * argv[])
17 char * pSmbPath = NULL;
18 char * pLocalPath = NULL;
24 "%s smb://path/to/file\n",
29 smbc_init(get_auth_data_fn, debug);
31 if ((fd = smbc_open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0)) < 0)
37 strcpy(buffer, "Hello world.\nThis is a test.\n");
39 ret = smbc_write(fd, buffer, strlen(buffer));
49 if (smbc_stat(argv[1], &st) < 0)
55 printf("Original size: %lu\n", (unsigned long) st.st_size);
57 if ((fd = smbc_open(argv[1], O_WRONLY, 0)) < 0)
63 ret = smbc_ftruncate(fd, 13);
69 perror("smbc_ftruncate");
73 if (smbc_stat(argv[1], &st) < 0)
79 printf("New size: %lu\n", (unsigned long) st.st_size);