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

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.

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

Sincerely yours;

jdm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.