Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

dear OCV, if you look at the docs for ctime, you'll see that the date string ends with "\n".

putText can't show newlines, and thus prints a '?' for anything it does no know.

there's 2 things you can do about it:

° take out the axe, and chop off the last char:

time_t now;
time(&now);
char * ct = ctime(&now);
int l = strlen(ct);
ct[l-1] = 0;
putText(im,ct, ...

° use strftime instead, and format your own date.

(as a side note, next time please try to cut it down to a minimal testcase (all your face detection code has got nothing to do with the problem. also, if you post code, please use the 10101 button to format it properly)

dear OCV, if you look at the docs for ctime, you'll see that the date string ends with "\n".

putText can't show newlines, and thus prints a '?' for anything it does no not know.

there's 2 things you can do about it:

° take out the axe, and chop off the last char:

time_t now;
time(&now);
char * ct = ctime(&now);
int l = strlen(ct);
ct[l-1] = 0;
putText(im,ct, ...

° use strftime instead, and format your own date.

(as a side note, next time please try to cut it down to a minimal testcase (all your face detection code has got nothing to do with the problem. also, if you post code, please use the 10101 button to format it properly)

dear OCV, if you look at the docs for ctime, you'll see that the date string ends with "\n".

putText can't show newlines, and thus prints a '?' for anything it does not know.

there's 2 things you can do about it:

° take out the axe, and chop off the last char:

time_t now;
time(&now);
char * ct = ctime(&now);
int l = strlen(ct);
ct[l-1] = 0;
putText(im,ct, ...

° use strftime instead, and format your own date.date.

actually i'd recommend the latter, as you got more control on the outcome here (what country are you in ? you'd want to format your date according to that)

(as a side note, next time please try to cut it down to a minimal testcase (all your face detection code has got nothing to do with the problem. also, if you post code, please use the 10101 button to format it properly)