TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Daniel Davis
date: 1995-12-12 21:27:59
subject: I`m confused about a snippet of cod

I have the following code:

function()
{
   PCHAR cTest;

   cTest = (PCHAR) malloc(12);
   
   strcpy(cTest, "12345678901"); // 11 characters

   WinMessageBox(cTest); // for brevity I'm eliminating the other parameters
                         // but it's a normal message box that displays the 
                         // string..

   free(cTest);
}

This is greatly simplified but it shows the necessary lines of code.

No matter what I do it ALWAYS displays the first 3 chars and truncates the
rest..  I've tried everything I can think of.. oh and I've used 'char *',
'PSZ', and 'PCHAR' and it doesn't affect the problem..

Anybody know what's causing this and how to fix it?  I've got a severe
memory leak somewhere and I'm trying to eliminate it but this is preventing
me from working on it..
  l8r,
   Daniel


--- Maximus/2 3.00
* Origin: Programmer's Den (1:112/66)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809
@PATH: 112/66 1 3620/9 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.