now i'm using this code
Code:
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sstream>
#include <iostream>
#define READ 0
#define WRITE 1

using namespace std;

int main()
{
    int ficheiro_fd;
    int pipe_fd[2];
    char buffer[20], buffer2[20];
    int num_bytes;
    int infp;
    pipe(pipe_fd);

    switch ( fork() ) {
    case -1:
        exit(1);
    case 0:
        close(pipe_fd[1]);
        //close(pipe_fd[0]);
        dup2(pipe_fd[0], 0);
        
        execlp("/usr/bin/base64"," ", NULL);
        break;
    default:
        close(pipe_fd[0]);
        //dup2(pipe_fd[1], 1);
        //ficheiro_fd = open("output.txt", O_RDONLY);
    while ((num_bytes = read(fileno(stdin), buffer, 1)) > 0){
            write(pipe_fd[1], buffer, num_bytes);            
            }
            
            while ((num_bytes = read(pipe_fd[1], buffer, 1)) > 0){
                //    write(fileno(stdout), buffer, num_bytes);
                //    break;
                    }
        close(pipe_fd[1]);
        wait((int*)getpid());
    }
    
    

    return 0;
}
but i dont know how to get the data from the command, just how to send