VS打包C语言软件为安装包后,再安装显示debug assertion failed

各位大神~这是我写的代码,在vs里直接调试运行,或者直接运行生成的exe文件都是可以正常运行的,但是打包成安装包之后,安装在原本的电脑上,没有办法正常使用,显示debug assertion failed,有没有大神知道怎么办啊TAT
两个不一样的只有显示的那一句printf,完全一模一样的时候也是一样的问题

#include <stdio.h>
#include <stdlib.h>
#define MAXLEN 100

int readline(char str[]);
int main() {
        
    int i = 0 , j , a , b ;
    char str[200];

    FILE* fp2;
    char ch, file[MAXLEN],file1[MAXLEN + 1];
    int len;
    FILE* fp1 = fopen("C:\\Users\\DELL\\Desktop\\file.txt", "wt+");
    
    printf("请输入文件名:\n");
    while ((len = readline(file)) > 0) {
        if ((fp2 = fopen(file, "rt")) == NULL) {
            printf("文件打开错误,请重新输入:\n");
        }
        else {
            while ((ch = fgetc(fp2)) != EOF) {
                while (fgets(str, 200, (FILE*)fp2) != NULL)
                {
                    i++;
                    if (str[0] == 'X' || str[0] == 'Y' || str[0] == 'Z')
                    {
                        j = 0;
                        a = 0;
                        while ((j < 150) && (a < 4))
                        {
                            if (str[j] == 32 && str[j + 1] != 32)
                            {
                                a++;
                                j++;
                                printf("%d", a);
                            }
                            else
                                j++;
                        }
                        while (str[j] != 32)
                        {
                            if (str[j + 1] != 32)
                            {
                                fprintf(fp1, "%c", str[j]);
                                j++;
                            }
                            else
                            {
                                fprintf(fp1, "%c\n", str[j]);
                                j++;
                            }

                        }

                    }
                }
            }
            fclose(fp2);
            printf("\n输出完毕\n");
        }
    }
    return 0;
}

int readline(char str[])
{
    int i, c;
    for (i = 0; i < MAXLEN - 1 && (c = getchar()) != EOF && c != '\n'; ++i)
    {
        str[i] = c;
    }
    str[i] = '\0';
    return i;
}

img

img

一样的问题:

(1)读取文件的路径对不对
(2)用管理员权限运行看看