6 #include <libsmbclient.h>
7 #include "get_auth_data_fn.h"
10 int main(int argc
, char * argv
[])
22 "%s smb://path/to/file\n",
27 smbc_init(get_auth_data_fn
, debug
);
29 if ((fd
= smbc_open(argv
[1], O_WRONLY
| O_CREAT
| O_TRUNC
, 0)) < 0)
35 snprintf(buffer
, sizeof(buffer
), "%s", "Hello world.\nThis is a test.\n");
37 ret
= smbc_write(fd
, buffer
, strlen(buffer
));
47 if (smbc_stat(argv
[1], &st
) < 0)
53 printf("Original size: %lu\n", (unsigned long) st
.st_size
);
55 if ((fd
= smbc_open(argv
[1], O_WRONLY
, 0)) < 0)
61 ret
= smbc_ftruncate(fd
, 13);
67 perror("smbc_ftruncate");
71 if (smbc_stat(argv
[1], &st
) < 0)
77 printf("New size: %lu\n", (unsigned long) st
.st_size
);