fix invalid str

This commit is contained in:
ubuntu201711081 2020-12-05 02:21:10 +00:00
parent 7b5e554d85
commit 62c116200c
2 changed files with 4 additions and 2 deletions

View File

@ -75,10 +75,11 @@ void DisplayProgressBar(size_t offset,size_t total,double cur_progress){
}
void DisplayProgressBar100Percent(size_t total){
size_t i;
char buf[PROGRESS_BAR_WIDTH];
char buf[PROGRESS_BAR_WIDTH+1];
for (i = 0; i < PROGRESS_BAR_WIDTH; i++){
buf[i] = '=';
}
buf[PROGRESS_BAR_WIDTH] = '\0';
printf("\r[%s]: 100%% bytes: %ld/%ld bytes\n",buf,total,total);
}
int recvFile(int sock, const char * filename,size_t file_size){

View File

@ -76,10 +76,11 @@ void DisplayProgressBar(size_t offset,size_t total,double cur_progress){
}
void DisplayProgressBar100Percent(size_t total){
size_t i;
char buf[PROGRESS_BAR_WIDTH];
char buf[PROGRESS_BAR_WIDTH+1];
for (i = 0; i < PROGRESS_BAR_WIDTH; i++){
buf[i] = '=';
}
buf[PROGRESS_BAR_WIDTH] = '\0';
printf("\r[%s]: 100%% bytes: %ld/%ld bytes\n",buf,total,total);
}
int recvFile(int sock, const char * filename,size_t file_size){