Calling a C function with a varargs argument dynamically

前端 未结 10 1427
太阳男子
太阳男子 2020-12-05 11:45

I am programming in C against a third party library (in HP/Mercury Loadrunner) that allows a varargs-style variable size argument list for one of it\'s functions. I want to

10条回答
  •  孤城傲影
    2020-12-05 11:51

    Can you restructure your code so that this isn't necessary? Perhaps you could take the incoming buffer and make it more deterministic:

    struct form_field
    {
      char[FIELD_NAME_MAX] name;
      char[FIELD_VALUE_MAX] val;
    };
    
    web_submit_data_buffer_gazillion_items( const char *bufferName, const char *bufferValue)
    {
        /*
          loop over bufferName somehow, either with a known size or terminating record,
          and build an array of form_field records
        */
        //loop
        {
          // build array of records
        }
    
    
        web_submit_data(record_array, array_len);
    
    }
    

    Sorry this couldn't be more fleshed out - my wife called me in for breakfast. :-)

提交回复
热议问题