Solved

bzero/bcopy : undefined

Posted on 2004-09-05
2
2,616 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now