Best wishes, Kurt !
Как-то раз, в одной пластилиновой местности,
Kurt Kuzba отписал к Anton S. Maximenko:
AS>> {
AS>> char z[10];
AS>> gcvt(what,10,z);
AS>> write(x,y,color,bk_color,z);
AS>> };
AS>> All looks to be nice, but this function makes my program
AS>> unstable, so, it will write string, but at the and of
AS>> program OS/2 shows that "This program cannot continue..."
AS>> What happenings ?
AS>> PS. Sorry for my dirty english :(
KK> Maybe you should make z[11] instead of z[10] for NUL
KK> terminator to fit into your allocated space? :)
KK> We aren't hiding. We are just catching some z's. ;)
Thanks, I found my mistake. I must not create vector - only pointer,
becouse if I makes gcvt(what,10,z) i will loose all 10 bytes of memory :)
So, correct version :
char * z; // simple the best.
......
I have not allocate bytes of memory for string becouse function allocates it
itself :)
Hiding in the grave
Anton S. Maximenko
--- GoldED/2 2.50+
---------------
* Origin: Night is so beautiful (we need her as we need Day (2:5020/535.29)
|