|
||
|
||||
|
Hello pwngrammer and welcome to the java programming forums. I think this belongs in the java program collaboration section located here: Project Collaboration - Java Programming Forums
I would help you out here but I don't know much about file I/O in java. Sorry .
|
|
||||
|
welcome to the java programming forums.
it thinks this will help you. it can give you ramdon numbers, so it can be used for password. ![]() http://www.javaprogrammingforums.com...m-numbers.html bout writing in a file, hmm, try to search for it. kinda busy. but i will try to keep in touch. ![]() Cheers, Truffy |
|
||||
|
Hello pwngrammer, welcome to the forums
![]() Don't forget about our Tips & Tutorials forum. There are lots of code snippets in there: Java Tips & Tutorials - Java Programming Forums This is what you need for writing a file: http://www.javaprogrammingforums.com...sing-java.html I will write an example application for you ASAP...
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight] Forum Tip: Add to peoples reputation ( ) by clicking the button on their useful posts.
|
|
||||
|
Quote:
![]() Try this pwngrammer: Java Code
import java.io.*;
import java.util.Random;
public class Pwngrammer {
/**
* JavaProgrammingForums.com
*/
public static void main(String[] args) throws Exception {
Random r = new Random();
Writer output = null;
File file = new File("PasswordFile.txt");
output = new BufferedWriter(new FileWriter(file));
int password = 0;
for(int a = 0; a < 4; a++){
password = (int)(9.0 * Math.random()) + 1;
System.out.print(password);
String myString = Integer.toString(password);
output.write(myString);
}
output.close();
System.out.println("");
System.out.println("Password written to file.");
}
}
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight] Forum Tip: Add to peoples reputation ( ) by clicking the button on their useful posts.
|
|
||||
|
There are no errors in that code. It was tested before posting. Did you include the imports? import java.io.*;
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight] Forum Tip: Add to peoples reputation ( ) by clicking the button on their useful posts.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Password Generator? | Lizard | What's Wrong With My Code? | 3 | 16-05-2009 12:49 PM |