C++类中有一个FILE指针,为什么我在类外或类内使用rewind()总是出现段错误?

问题描述 投票:0回答:0
class FileOpen
{
private:
    string filePath, fileName, path, backslash = "\\";
    int option;
    FILE* fp, *outfp;
public:
    void getFilePath();
    void getFileName();
    void setOption();
    bool setfp();
    bool setoutfp();
    FILE *getfp() { return fp; }
    FILE *getoutfp() { return outfp; }
    int getOption() { return option; }
    friend void statistic(FILE *fp, FILE *outfp, int option);
    friend int getLen(FILE *fp);
    void re(){rewind(fp);}
};

尝试复制main中的指针,故障依旧 我也尝试在public section做指针,故障依旧

c++ function file class pointers
© www.soinside.com 2019 - 2024. All rights reserved.