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#
  4. append array of byte to other which contains '0'

append array of byte to other which contains '0'

Scheduled Pinned Locked Moved C#
data-structureshelptutorial
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.
  • M Offline
    M Offline
    MrKBA
    wrote on last edited by
    #1

    I have this function which append an array of byte to an other array of bytes but the problem appears when the source contains '\0' this what I have :

    private void Aes_Strcat(sbyte[] a_pchResult, sbyte[] pchResult, int m_iBlockSize)
    {
    int x = 0;

    != 0)

    {
    x++;
    }

    Buffer.BlockCopy(pchResult, 0, a\_pchResult, x, m\_iBlockSize);
    

    }

    here when the a_pchResult contains for example { -10, 15,3,45,17,25,0,56,41,12,0,0,0,0,0,0} and I want to add pchResult to it at the end (it means after the '12' element) but as you say it will add it after '25' because it find the '0' before the end. any idea how know the last position to add the new array at the end of source array if it contains '\0' element.

    OriginalGriffO 1 Reply Last reply
    0
    • M MrKBA

      I have this function which append an array of byte to an other array of bytes but the problem appears when the source contains '\0' this what I have :

      private void Aes_Strcat(sbyte[] a_pchResult, sbyte[] pchResult, int m_iBlockSize)
      {
      int x = 0;

      != 0)

      {
      x++;
      }

      Buffer.BlockCopy(pchResult, 0, a\_pchResult, x, m\_iBlockSize);
      

      }

      here when the a_pchResult contains for example { -10, 15,3,45,17,25,0,56,41,12,0,0,0,0,0,0} and I want to add pchResult to it at the end (it means after the '12' element) but as you say it will add it after '25' because it find the '0' before the end. any idea how know the last position to add the new array at the end of source array if it contains '\0' element.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Please do not post the same thing in multiple places - it wastes time and annoys people. You already have this is QA - so pick one and stick to it!

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      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