0

I need to parse a .txt that contains lines with three columns separated by spaces with these types of data:

string size_t string

What I have to do is save those three parameters in an array of structures. The function I made is:

bool setInput(std::istream& input, size_t n_tx_in, input_t *inputs){

    std::string line;

    for(size_t i=0; i< n_tx_in; i++){
        getline(input,line);
    }
    
}

And the structure is :

typedef struct{
    string tx_id;
    size_t idx;
} outpoint_t;

typedef struct{
    outpoint_t outpoint;
    string addr;
} input_t;

I don't know how to split each line and get those three parameters so I can store them in my array of inputs. What should I use ? Thanks for your help.

Sofía
  • 3
  • 2

0 Answers0