Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

bzero/bcopy : undefined

Posted on 2004-09-05
2
2,833 Views
Last Modified: 2012-05-05
Hello.        
I tried to compile some code (MSVC) with the following fragment.

bzero( k_opad, sizeof k_opad);
bcopy( key, k_ipad, key_len);

Visual studio don't seems to know those two functions. In which header file are they defined??
0
Comment
Question by:zeugje
2 Comments
 
LVL 23

Accepted Solution

by:
Mysidia earned 50 total points
ID: 11985498
#include <strings.h>

MSVC might not have it

in that case I suggest using the C string library
#include <string.h>
instead
and use these functions:
 memset(memory, 0, size);
 memcpy(destination, src, length);

use memmove instead of memcpy  (if the memory areas are allowed to overlap)

Or if you want to think of this in terms of macros s. like...

#define bzero(memArea, len)  memset((memArea), 0, (len))
#define bcopy(memSrc, memDst, memLen) \
                    memcpy((memDst), (memSrc), (memLen))
0
 

Expert Comment

by:pimpernel
ID: 11986219
Thanks. It works indeed.
(ps.: do you happen to know if this is correct: "#define caddr_t char*" (maybe both bzero and caddr_t are linux command/structures (????))
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question