Morgan
04-16-2002, 03:06 PM
I was wondering if I should use a resource string in the following situation:
I intend to upload a file to a temp directory on the phone. The file name will be of the form, "tmp/scriptX.txt" (where 'X' will be a number between 1 and 99 ). I'll determine the actual name at the time of uploading and use SPRINTF to create it with the format string, "tmp\\script%d.txt".
Now my question, should the format string be a resource, or simply a constant in my code. The trade-off seems to be between memory usage and the "flexibility" of a resource string.
For memory usage it seems better to use a local string constant for the format since it'll then be easy to determine its length and there is no wasted memory when I allocate the space for the file name. If I'm using a resource, I need to allocate enough memory to cover a worst case scenario (whatever that might be) for the size of the format string and file name.
Does anyone have any thoughts about this? Will I really regret it if I use a string constant in my code? Am I being totally brain dead?
Thanks.
I intend to upload a file to a temp directory on the phone. The file name will be of the form, "tmp/scriptX.txt" (where 'X' will be a number between 1 and 99 ). I'll determine the actual name at the time of uploading and use SPRINTF to create it with the format string, "tmp\\script%d.txt".
Now my question, should the format string be a resource, or simply a constant in my code. The trade-off seems to be between memory usage and the "flexibility" of a resource string.
For memory usage it seems better to use a local string constant for the format since it'll then be easy to determine its length and there is no wasted memory when I allocate the space for the file name. If I'm using a resource, I need to allocate enough memory to cover a worst case scenario (whatever that might be) for the size of the format string and file name.
Does anyone have any thoughts about this? Will I really regret it if I use a string constant in my code? Am I being totally brain dead?
Thanks.