This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a small program written in c language,this program is written only in one line,i want this program to get read from my java program and make it in a structured way,i tried to read my file through character by character but unable to find a solution,i got this idea in my mind as when we download some c files from web,we always have a program that is written in one line only,i want this program to get convert in to structured format through java coding:This is my code where i tried to read my program.
[Added code tags - see UseCodeTags for more details]
I've formatted it so it's a bit clearer what's going on.
Tony's right - those loops are never going to end. Once you're in the second while loop, the chances are that the third will never end because i never changes. But even if it does you're never going to break out of the outer loop - you have a while(true) and no break statement. That will only ever end if you get an exception.
Going back a step, though, what do you mean by "structured format"? What structure are you aiming for? And why are you trying to do it?
If you really want to write a C parser, be aware that's really not a simple job. It's not clear why you want to do that, but if that's what I was trying to do for some reason I'd be looking for a tool to do most of the work for me (see lexical analysers like JFlex).
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com