Friday, 27 September 2013

How to pass "unnecessary" pointers to a function?

How to pass "unnecessary" pointers to a function?

This function is given to me by an API:
void GetTime(uint8_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t* );
GetTime returns the time by writing to those pointers. Problem is, I only
need the value written to one of those pointers. If I could control
GetTime I'd either check if the pointers were null or return a struct
instead, but I can't.
This is my current solution, ignoring the dummy* pointers:
uint8_t* seconds, dummy0, dummy1, dummy3, dummy4, dummy5;
GetTime( dummy0, dummy1, dummy3, dummy4, dummy5, seconds );
Is there a neater way to solve this problem with less clutter?

No comments:

Post a Comment