tags:

views:

149

answers:

3

Hello all im porting c code to windows 32 bit using visual studio express
now i have 3 functions that i can't find any alternatives in windows
they are:
alarm
bzero
bcopy
what are the equivalent methods in C win32 ?

+4  A: 

alarm you are going to need to dig for the other two are:

#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)  
#define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0)
Romain Hippeau
The comma operator seems unnecessary, you could just cast the result of the functions to `void`.
caf
well now i see i need replacement for alarm function also...
+2  A: 

for alarm have a look at Win32-API function SetTimer().

+2  A: 

From which platform are you porting to windows? Anyhow bzero and bcopy are depreciated since quite a while.

for bzero:

This function is deprecated (marked as LEGACY in POSIX.1-2001): use memset(3) in new programs. POSIX.1-2008 removes the specifica- tion of bzero().

for bcopy:

This function is deprecated (marked as LEGACY in POSIX.1-2001): use memcpy(3) or memmove(3) in new programs. Note that the first two arguments are interchanged for memcpy(3) and memmove(3). POSIX.1-2008 removes the specification of bcopy().

So just fix your code and use the proposed replacements.

Jens Gustedt