I've found that fprintf has no innate ability to adjust the colour of the output text and cprintf utilized through "conio.h" cannot print to a file (not that I could find anyway).
I want to be able to adjust the colour of the fprintf output to green within the "data.text" file.
static void cursor_position_callback(GLFWwindow* w, double x, double y) { FILE *f = fopen("data.txt", "a"); if (f==NULL) { printf("Error opening file!\n"); } fprintf(f,"%0.3f: Cursor position: %f %f (%+f %+f)\n", glfwGetTime(), x, y, x - cursor_x, y - cursor_y); cursor_x = x; cursor_y = y; fclose(f); } The output will be used for mouse tracking data in an experiment to be run involving eye-hand tracking capabilities. Many thanks for your time.