Unable to replicate image recived from command line in code

By using the example programs I can get the image I want by using the following
dcraw_emu -w -T

I want to be able to to this in a program so that I can do it in memory and not have to write it to the disk. To do this I wanted to replicate the draw_emu command line first, then change it to everything happening in memory.

But the code I have doesn't seem to use the camera white balance or output to TIFF.

int ret;
LibRaw libRaw;
#define OUT libRaw.imgdata.params

putenv("TZ=UTC");

//Specify details
OUT.use_camera_wb = 1;
OUT.output_tiff = 1;

//Open image
ret = libRaw.open_file(input);
CheckReturn("Open");

//unpack the image
ret = libRaw.unpack();
CheckReturn("Unpack");

//Process image
ret = libRaw.dcraw_process();
CheckReturn("Process");

ret = libRaw.dcraw_ppm_tiff_writer(output);
CheckReturn("Write");

libRaw.recycle();

Forums: