This call:
Would that fail in any way if one of the buffers are empty? I get a runtime error (the infamour XP runtime error dialog).Code:strncpy(entry_buf, strstr(file_buf, sought_buf), MAX_ENTRY_LEN);
This call:
Would that fail in any way if one of the buffers are empty? I get a runtime error (the infamour XP runtime error dialog).Code:strncpy(entry_buf, strstr(file_buf, sought_buf), MAX_ENTRY_LEN);
Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.
- Mike McShaffry
Well if strstr() doesn't find anything, then you're in doo-doo because it returns a NULL pointer.
Plus strncpy() doesn't always append a \0 to the string, so if you're assuming that as well, then that could be another problem.
Assuming of course that you've allocated the amount of space you say you have.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.