编辑代码: 我现在可以在文件中写入时钟时间,但问题是,它不完全是时钟时间。它写了奇怪的数字,如00F3D ..等等。我不知道如果是由于因为时钟的时间包含在它冒号当它在字符串格式,例如:0:12C++高分列表调试错误
// Used for Highscores
struct highscore
{
char name[10];
int zombiesKilled;
char Date[10];
char *clock[10];
};
void highscoreBoard(int option, int zombKilled)
{
int quanity = 0;
int playerScore = 0; // the in Results for Highscores
FILE *streaming;
highscore data[10];
char *newClock = new char[clockData.clockTime.length() + 1];
strcpy(newClock,clockData.clockTime.c_str());
switch (option)
{
}
你究竟是什么意思? – Ryan12345
检查您是否具有读取和写入文件的适当权限。另外,在以读取模式打开它之后,您并未关闭流,但是在情况0下以写入模式打开之前,请确保在打开新流之前关闭所有流。 – holtc
我明白了!好吧,这太奇怪了。我能够成功地在文件中写入,但是在我进入它之后,我可以发现错误,但它仍然写入文件! – Ryan12345