Reputation: 0 Apprentice
- Active Posts:
- 28 (0.05 per day)
- 13-September 13
- Profile Views:
- Last Active:
- Mar 04 2015 05:03 PM
- OS Preference:
- Favorite Browser:
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
Posts I've Made
Posted 2 Mar 2015Yes, I've read that. This is my understanding: The first call tokenizes the first string up to my delimiter ",". A null character replaces my comma. The second call tokenizes the string between the null pointer (beginning at \0) and the next delimiter (","). The third call does the same. This process repeats for the second and third lines. By the fourth line, the method begins returning null because it is not finding anymore delimiters. This is the reason many people use a while token != NULL to tokenize a string.
The reason I asked about the code above is because it was in a sample provided by a Professor. If my understanding of strtok is correct, it shouldn't work. I was just wondering if I was missing something or is the approach incorrect?
Posted 6 Feb 2015Ahhhhhhh, I know what you mean now. I was confusing input/output redirection with passing command line parameters. You're the best!
Posted 6 Feb 2015Thanks for the reply, but it seems that the statement
String filePath = console.nextLine();creates a string from the first line of the file being input. For instance, if input.txt's first line were "this is the first line", filePath would be "this is the first line". The remainder of the code would then create a file named "this is the first line." What I'm trying to do is create a file with input.txt. So I would need something that would be equivalent to
Scanner file = new Scanner(new File("input.txt"));without the "input.txt." I'm not even sure if that's possible, I could be misunderstanding instructions.
The actual instructions state that I should input two file names as command line parameters. The program should not prompt the user to enter file names. And the program should be run via the command line "java programName input1.txt, input2.txt."
I was interpreting this as not hardcoding input names. Is that possible?
Posted 30 Jan 2015Sir,
I thank you for your patience!
Posted 29 Jan 2015Sorry for the multiple posts, I tried editing the previous but it wouldn't let me use a certain image extension. Then, I wasn't able to edit at all. But this site clearly explains what happens in memory when doing a push() function with JackOfAllTrades code: http://cslibrary.sta...dListBasics.pdf on page 15. It's called Correct Push() drawing.
Can anyone explain with the same terms of that drawing, what was happening with what I was trying to do? Help is appreciated, I'm just trying to grasp what is going on.
I hope this helps with your understanding...
This helps significantly. Thank you for the illustration. I was picturing head within WrongPushTest() pointing to the node containing one. Now I see how it works. Does the node containing one still exist after WrongPush() executes?
- Member Title:
- New D.I.C Head
- Age Unknown
- Birthday Unknown
n*(n+1) hasn't added any friends yet.