I'm building a simple slideshow and would like to exchange the FOR loop below into an infinite loop that will start over with picure 1 when picture 5 has been shown.
Im still new to C and I hope someone can help me
-
char *inputFile[] = {"/1.jpg","/2.png","/3.jpg","/4.png","/5.png",NULL};
-
-
for(i=0; NULL != inputFile[i]; i++) {
-
-
sprintf(max_image_file_path, DATADIR"%s", inputFile[i]);
-
-
... some code
-
-
}
-
Making the infinite loop isnt very hard but I dont know how to access the array and start over when I reached nr 5.
Thank you!
yes you are right making for loop into infinite is not a big deal
you can make it
-
int i = 0;
-
for( i ; i < 6 ; i++)
-
{
-
......
-
if ( inputFile[i] == NULL )
-
{ i = 0;
-
continue;
-
}
-
}
-
may be this is not the proper code but you have to do some thing like this.
I hope you got it the idea.
otherwise you can find out the lenght of char *array and do some manipulation to make it infinite.