4
votes

I already included <"stdio.h">

using this function

bzero(&server, length);

but the compiler says

error: 'bzero' was not declared in this scope

`

4
and why do you expect bzero to be declared? there is no such function in stdio required by the standard.BeyelerStudios
I think it works only in linux/mac os? not windows?.. in this video tutorial youtube.com/watch?v=Emuw71lozdA I follow the codes correctly for UDP programming in c, but seems not working in windows. they included #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> then it works on linux using bzero().User10259
@AldwaneLaytonBayarasViegan: That's indeed not working in Windows/C++. Even on Linux, it is poor C++ code. (Note that C and C++ are two distinct but similar languages)MSalters
if you follow the posix link it says that it is included in <strings.h> not <stdio.h>.pubs.opengroup.org/onlinepubs/009695399/functions/bzero.html. Any how you should not use this function any more, as it has been deprecated. Better to use memset in its place.Rndp13

4 Answers

9
votes

bzero() is not part of the standard library, it belongs to POSIX.

It's actually deprecated (note the LEGACY in the manual) now, so consider using memset() instead.

2
votes

I was trying to run some old code, and got the error. I have just inserted this after my imports:

#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
1
votes

Try to add <unistd.h> For me that's work for bzero and read at the same time.

0
votes

you should include <string.h> .