A
Andrew
Hi,
I have a scenario in which both the source and format string for a
sscanf() call is selected *at runtime*. The number of format
conversions/substitutions is known as well as the maximum length of
each, so it's easy enough to allocate the memory required dynamically.
The problem is, how do I call sscanf()?
The only way to acheive this I can think of is to mess with the stack
using embedded asm and call the function myself, but i'm unsure how I
could make this reasonably safe and portable. What I really need is a
function defined like this:
int asscanf(const char* source, const char* fmt, void** storage, int
storage_size);
where storage is an array of void* pointers for storing the converted
data.
Has anybody come up against this problem before or suggest anyway to
tackle it?
-- Andrew
I have a scenario in which both the source and format string for a
sscanf() call is selected *at runtime*. The number of format
conversions/substitutions is known as well as the maximum length of
each, so it's easy enough to allocate the memory required dynamically.
The problem is, how do I call sscanf()?
The only way to acheive this I can think of is to mess with the stack
using embedded asm and call the function myself, but i'm unsure how I
could make this reasonably safe and portable. What I really need is a
function defined like this:
int asscanf(const char* source, const char* fmt, void** storage, int
storage_size);
where storage is an array of void* pointers for storing the converted
data.
Has anybody come up against this problem before or suggest anyway to
tackle it?
-- Andrew