0

I'm working on a program that lets the user watch random videos and view random images. I have it to work, but I want to be able to check to see if the image is there and if so view it and if not then pick another image. Here is what I'm using to view the image. It is only part of the code. Thanks for your help.

ostringstream oss;
     oss << "\"P:\\New Folder\\New Folder\\files.{21EC2020-3AEA-1069-A2DD-08002B30309D}\\Images\\A\\";
     oss << rand()%num + 1;
     //oss << ".jpg\"";
     oss << end;
     oss << "\"";
     system(oss.str().c_str());

On another note I was wondering if it was possible to have graphics like this on a console program and if so, how would I go about doing it. Check attachment to see what I'm talking about.

Thanks for the help.

Sincerely yours;

jdm

Attachments screenshots.png 35.39 KB
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by jdm
0

Use could use a function like:

bool exists(string filename){
    ifstream infile(filename.c_str());
    if (infile.is_open()){
        infile.close();
        return true;
    }
    return false;
}

the flaw in this function is that it'll also return false when a file does exist but can't be opened.

0

Thanks for the help. I will give it a try.

Sincerely yours;

jdm

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.