braju.com | Java fprintf, printf, sprintf (fscanf, scanf, sscanf) |
HomeDownload Purchase History Examples Documentation API/javadoc FAQ Feedback About Donate Java scanf |
Command line optionsAfter downloading the package and installing it, try typing>java com.braju.beta.format.Format -help You will get Java printf version Beta 2 by Henrik Bengtsson. Copyright 1997-2001 Usage: java com.braju.format.Format [-help|-version|-out filename|-printf fmtstr [param]*|-scanf fmtstr [param]*]* Options: -help Print this message. -out Write results to a file. Default is to standard error, -printf Using the next argument (fmtstr) as the format string and one or more optional parameters (param) as values to be formatted by the printf method. -scanf Using the next argument (fmtstr) as the format string and one or more optional parameters (param) as variable names to store the scanf results. -version Print version information. Note that you can repeat the options! Example: java com.braju.beta.format.Format -printf "Yeah, %d%% %s." 100 Java prints Yeah, 100% Java. java com.braju.beta.format.Format -printf "Enter name: " -scanf "%s" "name" -out result.txt gives Enter name: world The file 'result.txt' will contain the line name=world At the moment there is no way to set the system environment variables from within Java. To get the results from scanf into environment variables one has to parse the result file. If anyone knows a better way, please tell me. |
|||||||||
|