scp send file
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
if (argc != 3) {
fprintf(stderr, "Usage: %s <file_to_send> <destination_path>\n", argv[0]);
exit(EXIT_FAILURE);
}
char *file_to_send = argv[1];
char *destination_path = argv[2];
char command[256];
snprintf(command, sizeof(command), "scp %s %s", file_to_send, destination_path);
if (system(command) == -1) {
perror("Error executing scp command");
exit(EXIT_FAILURE);
}
return EXIT_SUCCESS;
}