Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. memcat()

memcat()

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chaitanya22
    wrote on last edited by
    #1

    Like memcpy(), is there any method for appending the array i,e memcat()....how could i use it???

    G 1 Reply Last reply
    0
    • C chaitanya22

      Like memcpy(), is there any method for appending the array i,e memcat()....how could i use it???

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      There isn't a memcat() function that corresponds to the strcat() function. If you think about it, a 'memcat' function doesn't make sense. strcat() does string concatenation. A string is a sequence of bytes, terminated by a zero byte. The mem* functions operate on memory, which is a sequence of bytes, but not terminated. Instead, the mem*() functions require that you specify a size for the region of memory you are copying. Given that explanation, memcpy() will do 'memory concatenation' for you:

      memcpy(destination + destination_length,source,source_length);
      destination_length += source_length;

      In this case, you are 'concatenating' a source buffer that is source_length bytes long to the end of a destination buffer that is, prior to the concatenation, destination_length bytes long.


      Software Zen: delete this;

      Fold With Us![^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups