您好,我刚接触C语言,还没有完全了解指针。我正在为我的程序编写一个简单的用户名/密码身份验证过程,目前看起来像这样:
include_directories
我可以在authenticate_process方法中获取并打印出客户端用户名和密码,但是一旦到达execute_process(
COMMAND echo
COMMAND bash -c "g++ -E -Wp,-v - 2>&1"
COMMAND awk "/^#include .* starts here:$/,/^End of search list/ { if ($0 ~ /^ /) { print } }"
OUTPUT_VARIABLE SYS_INCLUDES_OUT)
separate_arguments(SYS_INCLUDES UNIX_COMMAND ${SYS_INCLUDES_OUT}) # create a list
include_directories(${SYS_INCLUDES}) # add list to includes
行,我就会得到void authenticate_process(int cli_sockfd){
/* Authentication Process */
write(cli_sockfd, "USN", 3);
char *username;
username = recv_msg(cli_sockfd);
printf("[DEBUG] Client username is %s.\n", username);
write(cli_sockfd, "PSW", 3);
char *password;
password = recv_msg(cli_sockfd);
printf("[DEBUG] Client Password is %s.\n", password);
//From Here the program breaks
bool approval = authenticate_login(username, password);
printf("%c", approval);
}
bool authenticate_login(char *username, char *password)
{
printf("Made it here");
FILE *file;
char *file_username;
char *file_password;
bool match;
printf("%s", username);
printf("%s", password);
// BLAH BLAH BLAH MORE CODE IN THIS SECTION
return match;
}
行,我相信这与我传递字符有关,但是我可能是错误的。有人可以解释一下,告诉我如何解决我的问题吗?