Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is "scnaf" on java??

 
guy dv
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can some one tell me what is the syntx of scanf?
i use jdk1.2 in dos format and i need to know what is scanf
syntx in java.

------------------
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guy,
There is no scanf in JAVA. scanf is a C library function. If you're looking for equivalant functionality, then I would recommend looking at the JAVA I/O classes.
-Peter
 
Brett Knapik
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was the nice thing about c/c++ having easy ways to get i/o unlike java.
------------------
I wish there was a button on my monitor to turn up the intellegince.
Theres a button called 'brightness' but it doesn't work
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java does provide plenty of tools to parse input streams, and none of them are as bug-inducing as scanf. On most C and C++ projects I've worked on we've had a "no scanf" rule, as it is just so hard to get right and so easy to crash the system with accidentally wrong input data.
Is there some sort of input parsing you actually need to do? I'm sure there are plenty of people here who could help.
 
henrik
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a free and fully functional Java printf/scanf at:
http://www.braju.com/beta/
It is a beta since it requires more testing before I can upgrade it to a full version. However, no bugs have been found. The very stable Java printf only package is at http://www.braju.com/ and that has been up and running since 1997.
Cheers,
Henrik Bengtsson
M.Sc. Computer Science
Ph.D. student in Statistics
Lund University, Sweden
h e n r i k b @ b r a j u . c o m
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
henrik
Thanks for your input, hopefully some of our visitors can make use of your product. However, your name is not in keeping with the naming policy here at the ranch. Please re-register under an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!

------------------
Dave
Sun Certified Programmer for the Java� 2 Platform
 
Henrik Bengtsson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about that!
"henrik"
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Henrik
Hope you enjoy your time here at the ranch!!

------------------
Dave
Sun Certified Programmer for the Java� 2 Platform
 
Dustin Sallings
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a very old thread, but it comes up pretty early for anyone looking for scanf type functionality for java. I think MessageFormat is an appropriate way to handle this type of thing The Java Way(tm) (seen here in jython):
>>> import java
>>> mf=java.text.MessageFormat("{0} days {1}:{2}:{3}")
>>> os=mf.parse("1 days 4:20:02")
>>> os
array(['1', '4', '20', '02'], java.lang.Object)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic