Solved

bzero/bcopy : undefined

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MSVCR80.dll crash 2 134
SendMessage fails while PostMessage works 2 107
How to split this in C++ 4 93
C++ question 3 60
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

939 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

6 Experts available now in Live!

Get 1:1 Help Now