From 565a61dd9bf514e75d6c5406010535d04650bd6e Mon Sep 17 00:00:00 2001 From: stmctommyau Date: Sat, 16 Sep 2023 17:59:00 +0800 Subject: [PATCH] fix --- utils.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utils.h b/utils.h index c4b3c20..995ab0c 100644 --- a/utils.h +++ b/utils.h @@ -31,13 +31,17 @@ void fflush_stdin(){ #endif } -char * welcome_message(FILE * fp){ //cross compatible - if(!fp){//if fp is NULL +char * welcome_message(void * ptr){ //cross compatible + + if(!ptr){//if fp is NULL return "><\n"; } - fprintf(fp,"><\n");//welcome messgae + if(feof(ptr)){// if ptr a string or file + sprintf(ptr,"><\n");//welcome message + }else{ + fprintf(ptr,"><\n");//welcome message + } } - int choices_selecter(char * Items[],int items,char * welcome_messages){ int choice = 0; do{