简体   繁体   中英

Best datatype for returning bulk data from a C++ function

I have one C++ method/function like below

std::string TestWrapImpl::doProcess(std::string dirPath, std::string cmdLine) {
  std::string TestWrapVar = "";

  // Businesslogic here
  // TestWrapVar = {BulkData From Business Logic} 
  // Sample Bulk Data - "<xml><node01><FNAME>KRISHNA</FNAME></node01>
  //                     <node02><FNAME>KRISHNA</FNAME></node02></xml>"

  return TestWrapVar;
}

What is the best datatype to return this 2GB of XML Content? (Maybe a string datatype can't hold a 2GB string.)

Better write content into files and map them to the memory (I hope, you have a 64-bit environment).

Although, XML is one of most inappropriate formats to hold such amounts of data. It's due to large coefficient of increasing data size and low parsing speed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM