Printf cufft result

Sorry to my short english expression.

These days I tried to make a cufft result to txt file.

I succeeded to image cufft and I want to print out this result to text file.

FILE outfile;
for(int i=0; i<imageHeight
imageWidth; i++)
fprintf(outfile, “%?”,result[i]);

Cufft result is complex type…I don’t know about “%?” part…

If I want to see the complex result in text file, what shoule I write down the “%?” part?

I need help…thank you for reading.

cuComplex is really the C99/C++ complex type, so you should be able to use creal() and cimag() to extract the real and imaginary component of your complex type and print each using %f. Your code becomes

FILE *outfile;


for(int i=0; i<imageHeight*imageWidth; i++)


fprintf(outfile, "%f + %fi",creal(result[i]), cimag(result[i]));



Thank you for your help. ^^ I really appreciate your help and I finished my problem.

Tanks a lot again and have a nice day~^^