Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Re: How do I write output from one program to several files?

    Can you explain what the program does? What does "not working" mean?
  2. Re: How do I write output from one program to several files?

    If all the jobs are in an array, then pass each thread indexes into the array for the first and last job it is to process.
    For N jobs and T threads
    first thread gets: 0, N/T-1
    second thread gets:...
  3. Re: How do I write output from one program to several files?

    Give each thread N/i jobs
  4. Re: How do I write output from one program to several files?

    How are the "jobs" defined and created? Do you know how many "jobs" will be created? Can you differentiate between one "job" and another?
    Is there a first "job" and a second "job" and a third "job"...
  5. Re: How do I write output from one program to several files?

    It depends on how the jobs are defined. See my example in post#36
    If the jobs were: 1,2,3,4,5,6 and there were 3 threads
    Then the jobs could be assigned this way:
    thread one does jobs 1 & 2...
  6. Re: How do I write output from one program to several files?

    Do you see how to compute which jobs are assigned to each thread?
    Divide the number of jobs by the number of threads and allocate the jobs from that.
  7. Re: How do I write output from one program to several files?

    Does that mean this?
    Say there are 6 jobs and 3 threads:
    thread one does jobs 1 & 2
    thread two does jobs 3 & 4
    thread three does jobs 5 & 6
  8. Re: How do I write output from one program to several files?

    Post the code that you are having problems using threads in and explain what the threads are supposed to do.
    The last problem had nothing to do with trying to do parallel processing using threads.
  9. Re: How do I write output from one program to several files?

    Is this "job" some data being written to a file
    or is it the execution of some code?
    The use of the word jobs is ambiguous for me.

    How does the code control which thread gets which "job"? Is...
  10. Re: How do I write output from one program to several files?

    The Scanner class has methods for reading from text files.


    Can you explain why you want to use threads.
    What do you mean by "job"
    what is to be shared?
  11. Re: How do I write output from one program to several files?

    There were several error messages mixed in with the program's output.
    In this one there was a varible with a null value at line 113. Look at line 113, find the variable that had a null value and...
  12. Re: How do I write output from one program to several files?

    Please copy the full text of the error message and paste it here.
    Look at the line where the NPE happens, find the variable with the null value and backtrack in the code to see why that variable...
  13. Re: How do I write output from one program to several files?

    That makes it easier to read and understand.

    Now you need to move the open and close of the file outside the loop.
    Every time you open a file, write to it and close it, the file's previous...
  14. Re: How do I write output from one program to several files?

    Did you see the steps I suggested for the program in post#15?
    Here they are again:
    Open some output files to write items to<<<<The files are all opened BEFORE the loop
    loop through a list of...
  15. Re: How do I write output from one program to several files?

    Did you notice after posting the above that the code was not formatted?


    Is that what you wanted to happen?
    If not, please explain what you want the code to do that it did not do.


    Did you...
  16. Re: How do I write output from one program to several files?

    Now try writing the code to do it.
  17. Re: How do I write output from one program to several files?

    Your posts have been made visible now.

    Is this what you are trying to do:
    Open some output files to write items to
    loop through a list of items
    write item to one of the files based on its...
  18. Re: How do I write output from one program to several files?

    You should define the String: outputFileName before the if statements, not inside of them where they are local variables known only inside the if. You can assign a value to the String inside the if...
  19. Re: How do I write output from one program to several files?

    Can you make a list of the steps the program should take to do it job? When will it open each file?
    When will it write a record to a file? When will it close each file?

    Please edit your post...
  20. Re: How do I write output from one program to several files?

    Question moved from Member Introductions section.

    What part of the program are you having problems with?
    The decision part has been specified here:


    If the files are text files, look at using...
Results 1 to 20 of 20