Different format of .dat files in different software

In summary, the conversation discusses issues with opening .dat files generated using Fortran on a cluster. The files can be accessed through WinSCP, but the formatting is different when opened in different programs. The solution is to use a better text editor, such as Notepad++, to view the files.
  • #1
kelvin490
Gold Member
228
3
I have generated some .dat files using Fortran on a cluster. I need to use WinSCP(https://winscp.net/eng/download.php) to access files in the cluster so sometimes I just use the WinSCP to open the .dat files generated. The data can be shown regularly like this one: https://www.dropbox.com/home/Pictures?preview=notepad2.jpg
notepad2.jpg


However, if I download it to my desktop and open it with notepad it becomes like this: https://www.dropbox.com/home/Pictures?preview=notepad1.jpg

notepad1.jpg

It bothers me because usually I read the file in PC and I need to share it to some other people and I don't expect they open it in WinSCP. How can I change the format so it looks better? Thank you.
 
Last edited:
Technology news on Phys.org
  • #2
Dropbox requires a sign-in for your links. You should use some other method.
 
  • #3
phinds said:
Dropbox requires a sign-in for your links. You should use some other method.
I agree completely. Can't you just attach the files, instead of posting images of them?

BTW, are the .dat files you (OP) create text files or are they binary files?
 
  • #4
Mark44 said:
I agree completely. Can't you just attach the files, instead of posting images of them?

BTW, are the .dat files you (OP) create text files or are they binary files?

Sorry for the trouble. Actually I tried to attach pictures directly but it still ask me to put the picture's URL. I copied the link to it but it seems doesn't work.
For the .dat file, I only know it's .DAT type by checking the properties of the file. In Fortran I just use the "open" function, for example: open(10, file = 'Overall.dat', form = 'formatted',status = 'unknown',position="append") to create and then write the file. Curiously, if I run the program in my PC, the file generated is good and just looks like the first picture above. The problem just occurs when I run it in the cluster to creates the .dat file then download it to my PC.
 
  • #5
kelvin490 said:
Sorry for the trouble. Actually I tried to attach pictures directly but it still ask me to put the picture's URL. I copied the link to it but it seems doesn't work.
Well, don't fool around with links (URLs), just post the images here directly.
 
  • Like
Likes kelvin490
  • #6
kelvin490 said:
Sorry for the trouble. Actually I tried to attach pictures directly but it still ask me to put the picture's URL. I copied the link to it but it seems doesn't work.
Use the upload button on the bottom right to post pics from your computer.
 
  • Like
Likes kelvin490
  • #7
phinds said:
Well, don't fool around with links (URLs), just post the images here directly.

I can attach it now. Thanks a lot.
 
  • #8
I think you are running afoul of the carriage control (how the computer says "give me the next line").
Fortran uses a channel control character like a '0' as the very first character of a "line". gfortran still implements this.

DOS uses (hence notepad) \r and \n at the end of a line (ASCII 10 and ASCII 13)
UNIX uses \n.

Since we cannot see what is going on - all of the above is simply a guess.
Please tell what platforms (and OS) are involved: like "the cluster" Is it a Linux cluster?
 
  • Like
Likes kelvin490
  • #9
jim mcnamara said:
I think you are running afoul of the carriage control (how the computer says "give me the next line").
Fortran uses a channel control character like a '0' as the very first character of a "line". gfortran still implements this.

DOS uses (hence notepad) \r and \n at the end of a line (ASCII 10 and ASCII 13)
UNIX uses \n.

Since we cannot see what is going on - all of the above is simply a guess.
Please tell what platforms (and OS) are involved: like "the cluster" Is it a Linux cluster?

Yes, it's a Linux cluster and my OS is Win 8. In the cluster I use commands like pgf90 to compile the program and in my PC I use GNU or PGI Fortran. Are there any means to convert the files back to desirable format?
 
  • #10
Try opening it in Wordpad or https://notepad-plus-plus.org/download/v6.9.1.html. Plain old notepad is pretty bad with carriage returns from different OS's. Notepad++ is also really good with large data files. I'm currently working with a 200 Meg file using it and the file opens quickly.
 
  • Like
Likes kelvin490 and jim mcnamara
  • #11
unix has the dos2unix and unix2dos command to reformat files. Most decent editors can do this too. Use the unix commands on the linux boxes.
 
  • #12
Borg said:
Try opening it in Wordpad or https://notepad-plus-plus.org/download/v6.9.1.html. Plain old notepad is pretty bad with carriage returns from different OS's. Notepad++ is also really good with large data files. I'm currently working with a 200 Meg file using it and the file opens quickly.
I agree completely about Notepad++ ... SO much better than notepad in a huge number of ways, given all the features it has
 
  • Like
Likes kelvin490

1. What is a .dat file?

A .dat file is a generic data file that can contain various types of data, such as text, images, or other forms of information. It is used by many different software programs to store and organize data.

2. How do .dat files differ between different software programs?

The format of .dat files can vary between different software programs depending on the specific needs and capabilities of each program. This means that the way data is stored and organized within a .dat file may differ, making it difficult to use the same file across multiple programs.

3. Can .dat files be opened and edited in any software program?

No, not all software programs have the capability to open and edit .dat files. It is important to use the appropriate software for the specific .dat file you are trying to work with.

4. Are .dat files interchangeable between different operating systems?

In most cases, .dat files are not interchangeable between different operating systems. This is because the way data is stored and read can vary between operating systems, making it difficult for a .dat file to be read and used in a different system.

5. How can I convert a .dat file to a different format?

There are various software programs and online tools available that can help convert a .dat file to a different format. However, the success of the conversion may vary depending on the complexity of the data and the compatibility of the software used.

Similar threads

  • Programming and Computer Science
Replies
7
Views
2K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
14
Views
1K
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
11
Views
2K
  • Programming and Computer Science
Replies
4
Views
5K
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
5
Views
3K
  • Introductory Physics Homework Help
Replies
2
Views
749
Back
Top