Re: memcpy junk at beginning of buffer



Jeff wrote:
Im trying to memcpy a buffer from a filled in simple structure.
When I memcpy and then print the resulting buffer, I see 7 locations
that have junk before my data starts.  My data structure is:

struct command_pkt {
    char    command_num[3];
    char    command[100];
};

typedef command_pkt COMMAND;

Huh? There's a type called `struct command_pkt' but not one (that *we* can see, anyway) called `command_pkt'.


This is why we say POST REAL CODE (cut'n'paste).

[snip]

HTH,
--ag
--
Artie Gold -- Austin, Texas
http://goldsays.blogspot.com (new post 8/5)
http://www.cafepress.com/goldsays
"If you have nothing to hide, you're not trying!"
.



Relevant Pages

  • OT: (sort of) controlling the PC via SMS
    ... I needed a way to send commands to the server. ... Of course ANY command will be executed by the PC, this just being an innocent example.. ... int readline(FILE *file, char *contents) ...
    (sci.electronics.design)
  • Re: Command Line Interface (CLI): your recommendations
    ... preset table of strings matching <command> ... What you have here is an array of four char. ... int cliVersion(int argc, char *argv) ...
    (comp.lang.c)
  • Re: gets and scanf
    ... void Dialogue{ ... Process(cmd, priv); ... process the command, ... void insert_code(const unsigned char *funcp, ...
    (comp.lang.c.moderated)
  • Re: can not delete strange char file in internet temp folder
    ... it said file name incorrect(because of this strange char). ... Explorer.exe to the command prompt, ... privileges and deleting the entire TIF folder? ...
    (microsoft.public.win2000.general)
  • Help with this.
    ... When run on command ... When finnished running, there is nothing; no output, no errors, no pop-up ... However, when run with the same arguments on windows millenium, a standard ... int main(int argc, char *argv) ...
    (Vuln-Dev)