Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Wanted to converted code in java like fcntl.ioctl in python

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Post Wanted to converted code in java like fcntl.ioctl in python

    i want to do the code in java from Python .

    The code such as


    def get(self):#correction
    self.corrections = fcntl.ioctl(self.joystick, -2145097182, self.corrections)
    for n in range(5):
    self.correction[n].unpack(self.corrections[(n * 36)n + 1) * 36)])


    def set(self):
    self.corrections = ""
    for n in range(5):
    self.corrections += self.correction[n].pack()

    Kindly advice me


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,166
    My Mood
    Hungover
    Thanks
    141
    Thanked 597 Times in 512 Posts

    Default Re: Wanted to converted code in java like fcntl.ioctl in python

    Step 1- Convert the python code to English (or whatever your native language is). What does the code do? How does it do it?
    Step 2- Convert that English into pseudocode. How would you accomplish the same thing from an algorithmic perspective?
    Step 3- Convert that pseudocode into Java. How would you implement the pseudocode in Java?

    The point is, converting code from one language to another is not a direct 1 to 1 mapping. You have to think about what the code does, and then do it in Java. You can't just try to translate one syntactic "word" at a time.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following User Says Thank You to KevinWorkman For This Useful Post:

    muthukumar25 (March 17th, 2012)

  4. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Wanted to converted code in java like fcntl.ioctl in python

    thanks For ur reply ,
    here I don't know what the Syntax exactly doing in Python Like that code

    fcntl.ioctl

  5. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,166
    My Mood
    Hungover
    Thanks
    141
    Thanked 597 Times in 512 Posts

    Default Re: Wanted to converted code in java like fcntl.ioctl in python

    Then your step one is to figure out exactly what that function does. Sounds like a good place to start a google search.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. From python to java
    By JeremiahWalker in forum What's Wrong With My Code?
    Replies: 8
    Last Post: January 14th, 2012, 12:12 AM
  2. Java equivalant of Python re.match()
    By gonzalioz in forum Java Theory & Questions
    Replies: 1
    Last Post: October 30th, 2011, 10:25 AM
  3. Run Python file in Java code
    By soheilz92 in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: May 21st, 2011, 07:33 PM
  4. Replies: 10
    Last Post: April 5th, 2011, 09:09 AM
  5. Java equivalent of Pythonís struct.pack?
    By thiruvadi.e in forum Java SE APIs
    Replies: 2
    Last Post: July 14th, 2010, 03:09 AM