0
char*   iperf_get_test_json_output_string ( struct iperf_test* ipt );    // .h file

I am using iperf SDK .c file in iOS project in swift. Above function return (char *) pointer reference. I am getting pointer reference. Anyone Can help to get the string in swift using this above function?

var result =  iperf_get_test_json_output_string(test)
let temp = withUnsafePointer(to: result) {
          $0.withMemoryRebound(to: UInt8.self, capacity: MemoryLayout.size(ofValue: $0) ) {
               String(cString: $0)
           }
Ranoiaetep
  • 5,872
  • 1
  • 14
  • 39

0 Answers0