Send mavlink message using udp port/ c++

Hello, I’m trying to send Mavlink message in UDP port; this is the code i use :

int main()
{
	char help[] = "--help";

	char target_ip[100];

	int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
	struct sockaddr_in gcAddr;
	struct sockaddr_in locAddr;

	//struct sockaddr_in fromAddr;
	uint8_t buf[BUFFER_LENGTH];
	socklen_t fromlen = sizeof(gcAddr);

	int bytes_sent;
	mavlink_message_t msg;
	uint16_t len;


	/* Bind the socket to port 14551 - necessary to receive packets from qgroundcontrol */
	if (-1 == bind(sock, (struct sockaddr *)&locAddr, sizeof(struct sockaddr)))
	{
		perror("error bind failed");
		exit(EXIT_FAILURE);
	}

	
	memset(&gcAddr, 0, sizeof(gcAddr));
	gcAddr.sin_family = AF_INET;
	InetPton(AF_INET, _T("127.0.0.1"), &gcAddr.sin_addr.s_addr);
	gcAddr.sin_port = htons(14550);



	while(1)
	{

		/*Send Heartbeat */
		mavlink_msg_heartbeat_pack(1, 200, &msg, MAV_TYPE_HELICOPTER, MAV_AUTOPILOT_GENERIC, MAV_MODE_GUIDED_ARMED, 0, MAV_STATE_ACTIVE);
		len = mavlink_msg_to_send_buffer(buf, &msg);
		bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof(struct sockaddr_in));

		/* Send Status */
		mavlink_msg_sys_status_pack(1, 200, &msg, 0, 0, 0, 500, 11000, -1, -1, 0, 0, 0, 0, 0, 0);
		len = mavlink_msg_to_send_buffer(buf, &msg);
		bytes_sent = sendto(sock, buf, len, 0, (struct sockaddr*)&gcAddr, sizeof(struct sockaddr_in));

		memset(buf, 0, BUFFER_LENGTH);
		
	}
}

i get the error “Error (active) E0167 The argument of type “uint8_t (*) [2041]” is incompatible with the parameter of type “const char *”” about the variable buf in sendto.
Any help ?