I am using version 401/01 compiled for win32.
I have problems using strcat. The following little script does not work and I have no clue why… Maybe it is obvious, but apparently I am blind at this moment…
Char_t *a = “bla”;
Char_t b = “blo”;
strcat(b,a); // I expect blobla as output
I get an error message that the memory can’t be read and my root session is ended.
Thanks for your help
You stry to copy the 33 characters of b (including the null character)
to the array a with only 4 characters !!
Even if I invert the order in the strcat function and fix the size of the array, I get the same error.
This is a very basic C programming mistake.
Please send a concrete piece of code, so that we can diagnose where
you make the error.
Ok, here it is:
Char_t a = “bla”;
Char_t *b = “blo”;
These are not the first lines of C code I am producing and I have used this quite often, but never in Root. Moreover, if I run this from Microsoft Visual C, it works fine… The output is “blablo” as expected. Therefore my question.
on my ROOT-system (LINUX ROOT v400-04) your code runs whitout any problems (both code-examples).
Can you test your code on any other ROOT-version or OS?
I am running win2k and, unfortunately, no other option concerning the os.
I can not reproduce the problem on windows XP or win2k.
Then I guess that my Root installation must be screwed somehow…
I’ll have to fix it.
Thanks for your time!!
I finally reproduced the problem when using an optimized build.
It seems that it is due to a bug in the MSVC7 optimizer, a work-around will be uploaded to the CVS repository very shortly.