need some help here with writing in a file using print writer
So the first part of my programs works ok. what I got to do next is take the numclient and the metrage values
and do another calculation with them and save in another file afterwards.
whatever I put after the close statement it writes everything in red line
I tried wiping the sortie close line and it still writes everything I put in red
Basically what I did was repeat the first line with scanner clavier and the print writer line to be able to save a new file but no dice it seems
How do you do it?
I ran your code and it produced the DAT file. I opened it with the Eclipse editor and VIM editor, neither one had a problem. As a total guess, I'd say your system sees a file ending in ".DAT" and launches some application to view it and assumes the file does not contain text. Try a file name suffix of ".TXT".
Actually I think I need to do my program another way but I still hit a snag
In this version I have a file already with data about clients and an order
now the first part of my program reads it ok and puts on screen everything I have on that saved file
which is 2 strings of data
example (1234 10 . 2nd line is 2345 20)
Now the problem presents it self when I got to take each of these lines and do a mathematical process and then write it in another file
It only sees the second line but the first line it does not and thus it saves only line 2
how to make it do the maths process with all lines of that file and then save it in a new file
here is my code so far
I made a test file with lines containing a pair of numbers. The code works fine. There is definitely something wrong with either your environment or the way you are running the code. Did you replace print() with println()?
First of all Thanks Carey
Well I went over what you wrote and the problem was that both files were going blank
(the initial file from which the data was to be taken and the second one where the data was to be written)
I went line by line and could not figure the problem out.
so I tried adapting some of your changes to my old algo and it works to perfection
It reads the original file and does not blank it
it puts the data on screen
and then it saves everything on another file
Thanks and he is the final algo
Now I will continue it because I got to add costs which involves a mathematical equation .I will be working on that now
I might suggest cleaning up your code indentation if you want people on this site to help you. Either tabs (=4spaces), or 4 actual spaces. You have to use them consistently in order for the code formatter to behave correctly.