Hello
why this crash after few hours
ifstream picture_in (“Data/Rrpictures”, ios::in);
if(!picture_in) {
cout << “cannot open Rrpictures.\n”;
return 1;
}
char picturein[155];
picturein[155] = ‘\0’;
time_t lasttime_p = time(NULL)-NEXTP;
while (!quitProgram) {
if (time(NULL)>lasttime_p+NEXTP){
if (image == NULL) {
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0 ));
SFont_Write (screen, Font2, 100, 500, "No image");
}
else if (image){
SDL_FreeSurface(image);
}
// SDL_Delay(1);
picture_in.getline(picturein, 154);
image = IMG_Load(picturein);
if (image == NULL){
// cout << “problem with this picture” << ‘\n’;
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0 ));
SFont_Write (screen, Font2, 100, 500, “Problem in text file -->”);
WarmChannel = Mix_PlayChannel(-1, warm, 4);
}
else if (image){
src.x = 0;
src.y = 0;
src.w = image->w;
src.h = image->h;
dest.x = 0;
dest.y = 35;
SDL_BlitSurface(image, &src, screen, &dest);
SDL_BlitSurface(Picture, NULL, screen, &dest);//&Picture_Rectangle
SDL_UpdateRect(screen,0, 0, 0, 0);
}
cout << picturein << ‘\n’;
lasttime_p = time(NULL);
if (picture_in.eof()){
picture_in.clear();
picture_in.seekg(0, ios::beg);
cout << "EOF image" << '\n';
}
}
while (SDL_PollEvent (&event)) {
…
…
}
}
picture_in.close();
return 0;
}
pls can help me anyone, what i am doin wrong here?
BTW: why this not working if the file text is in DOS format?
ppap_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail