I just started using Julia and I cant seem to figure out how to write to .txt or .inp properly. I need to create a list with different compounds on different lines on .txt. I tried working with the normal text file handling and with delimitedfiles.
The export always look like this>
Compound1 Compound2 Compound3
and I need it to look like this:
Compound1
Compound2
Compound3
Using \n does not seem to work, I might be writing the Syntax wrong.
The output works fine when I write it to a .csv but I need it on a .txt file to run CosmoTherm (Software for predictive chemistry).
Can you post a short snippet of your code that demonstrates the problem?
Also how are you verifying your text file? One possibility is that your textfile has unix-style newlines but they’re not being displayed, for instance if you open in windows notepad.
It is working now. I didnt`t know the file would keep the newlines even though it wasnt showing when I opened the notepad. My bad. I just ran the cosmotherm application and it created the proper input from the txt file I created with Julia.
Julia uses \n (newline) as line terminators as is standard on all platforms besides Windows. Some old Windows applications—in particular Notepad—do not understand this as a line terminator and only understand \r (carriage return) as line terminators. These applications consider \n to be “some whitespace character” and probably render it as a space. I would recommend using a better text editor that understands newlines.