File dasOutputz = null;
for (int i = 0; i < something; i++) {
File daone2envy = new File("screen000002.jpeg");
if (!daone2envy.exists()) {
dasOutputz = daone2envy;
break;
}
}
if (dasOutput != null) {
}
(Don't use this, it's horrible)
|
Ok so I have this void which is simply written:
I want the screenshots to take one, it makes it screen00001, the next one is screen00002, the next screen00003, but I don't know how to make a loop check if the file exists and write the int.Code:nty leechers
Basically what I need you to do is write something that will check for the existing screenshots, and then choose the next number. so it will go 00001, 00002, and so on.
Rep and thanks to somebody who makes the int or method!
(I'm god awful with loops)
File dasOutputz = null;
for (int i = 0; i < something; i++) {
File daone2envy = new File("screen000002.jpeg");
if (!daone2envy.exists()) {
dasOutputz = daone2envy;
break;
}
}
if (dasOutput != null) {
}
(Don't use this, it's horrible)
would be easier if you didn't have them empty 0's in there
i think that's rightCode:public int getScreenshotID() { int id = 0; while(true) { File f = new File("screenshot"+id+".jpeg"); if (f.exists()) id++; else return id; } return id; }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |