Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the header file required by memcpy under Linux?

Shulou Source: shulou.com Published: 2022-06-01 22:32:58 09月26日 Update

Xiaobian to share with you under Linux memcpy required header file is what, I believe most people do not know how, so share this article for everyone's reference, I hope you read this article after a great harvest, let's go to understand it!

memcpy refers to the memory copy function used by C and C++ to copy resource memory (the memory region pointed to by src) to target memory (the memory region pointed to by dest).

unistd.h is the header file of unix class system definition symbolic constants defined by POSIX standard, which contains many UNIX system service function prototypes, such as read function, write function and getpid function.

The stdlib. hstdlib header file contains the most commonly used system functions in C and C++ languages.

stdlib.h defines five types, macros, and general utility functions.

Types such as size_t, wchar_t, div_t, ldiv_t, and lldiv_t;

macros such as EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX, MB_CUR_MAX, etc.;

Common functions such as malloc(), calloc(), realloc(), free(), system(), atoi(), atol(), rand(), srand(), exit(), etc.

3.unistd.h

is the header file for POSIX standard defined unix class system definition symbolic constants, containing function prototypes for many UNIX system services, such as read, write, and getpid functions

\4. string.h

Functions such as bzero,bcopy,bcmp,memset,memcpy memcmp are provided.

netdb.h defines network-related structures, variable types, macros, and functions. For example:

struct hostent *gethostbyaddr(const void *addr, size_t len, int type);

struct hostent *gethostbyname(const char *name);

sys/types.h: Data type definition

sys/socket.h: Provides socket functions and data structures

netinet/in.h: defines the data structure sockaddr_in

arpa/inet.h: Provides IP address conversion functions such as inet_pton, inet_ntop

netdb.h: Provides functions to set and obtain domain names

sys/ioctl.h: Functions that provide I/O control

sys/poll.h: Functions that provide socket wait testing mechanisms

fcntl.h: Functions that provide control over files

time.h: Provides a function of time

crypt.h: Provides encryption functions using DES encryption algorithm

pwd.h: Functions that provide access to the/etc/passwd file

shadow.h: Functions that provide access to/etc/shadow files

pthread.h: Functions that provide multithreaded operations

signal.h: Provides a function that operates on the signal

sys/wait.h, sys/ipc.h, sys/shm.h: Functions that provide process waiting, interprocess communication (IPC), and shared memory Suggestion: When writing network programs, you can directly use the following header file code #include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

When it comes to user permissions and password verification, add the following statement: #include

#include

#include

It should be noted that the encryption algorithm library should be linked at compile time, that is, the compilation option should be added:

-lcrypt

Add the following sentence to the file and time operations:

#include

#include

#include

#include

#include

When it comes to multi-process operations, add the following statement:

#include

#include

#include

#include

When it comes to multithreaded operations, add the following statement:

#include

#include Note that you should link the thread library at compile time, that is, add compile options:

-lthread

The above is "What is the header file required for memcpy under Linux" All the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Tags: Functions files memory systems types statements compilations data articles threads structures processes encryption content regions prototypes common constant copy point to Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB macOS Linux OPPO Reno MySQL