The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Help UFies! (c++ woes) by tzulah2004-07-14 13:33:11
  Memory allocation by elehack 2004-07-14 13:40:36
Is the memory being allocated anywhere?

You need a line like

buffer = malloc(length_of_memory_block);

or

buffer = new some_data_type[some_count];

so that the void pointer actually points to a valid writable area of memory.

In most cases like this, the PerformMagic function would also require the length of the buffer as a parameter, unless there's something weird going on not represented in your code fragment.

Hope that gets you started... look up malloc and new in your C/C++ reference if necessary.
[ Reply ]
    Don't forget to free() what you malloc()... by williamashbless2004-07-14 13:49:06

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)