7 #include <libsmbclient.h>
8 #include "get_auth_data_fn.h"
11 int main(int argc
, char * argv
[])
21 smbc_init(get_auth_data_fn
, debug
);
23 printf("CAUTION: This program will overwrite a file. "
24 "Press ENTER to continue.");
25 fgets(buffer
, sizeof(buffer
), stdin
);
30 fprintf(stdout
, "\nPath: ");
32 fgets(path
, sizeof(path
) - 1, stdin
);
33 if (strlen(path
) == 0)
38 p
= path
+ strlen(path
) - 1;
44 if ((fd
= smbc_open(path
, O_WRONLY
| O_CREAT
| O_TRUNC
, 0)) < 0)
50 strcpy(buffer
, "Hello world\n");
52 ret
= smbc_write(fd
, buffer
, strlen(buffer
));