Different format of .dat files in different software

Click For Summary

Discussion Overview

The discussion revolves around the formatting issues of .dat files generated by Fortran on a cluster and accessed via WinSCP. Participants explore the differences in how these files appear when opened in different software, particularly between WinSCP and Notepad, and seek solutions for better compatibility and readability.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants note that the .dat files appear correctly in WinSCP but not when downloaded and opened in Notepad, suggesting a formatting issue.
  • There is a discussion about whether the .dat files are text or binary, with some participants questioning the nature of the files created by the original poster (OP).
  • One participant suggests that the issue may relate to carriage control characters used by Fortran, which differ from those expected by Windows applications like Notepad.
  • Another participant mentions that DOS and UNIX handle line endings differently, which could contribute to the formatting problem.
  • Suggestions are made to use alternative software like Wordpad or Notepad++ for better handling of the files, as Notepad may not display them correctly due to carriage return issues.
  • Some participants mention the use of commands like dos2unix and unix2dos to reformat files on UNIX systems, indicating potential solutions for the OP.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to resolve the formatting issues, with no consensus on a single solution. Multiple suggestions are provided, but the discussion remains unresolved regarding the most effective method to convert or view the .dat files correctly.

Contextual Notes

Participants note the importance of specifying the operating systems and platforms involved, as the behavior of the .dat files may depend on these factors. The discussion highlights the limitations of certain text editors in handling files with mixed line endings.

kelvin490
Gold Member
Messages
227
Reaction score
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
Dropbox requires a sign-in for your links. You should use some other method.
 
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?
 
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.
 
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   Reactions: kelvin490
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   Reactions: kelvin490
phinds said:
Well, don't fool around with links (URLs), just post the images here directly.

I can attach it now. Thanks a lot.
 
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   Reactions: kelvin490
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   Reactions: 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   Reactions: kelvin490

Similar threads

  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 29 ·
Replies
29
Views
3K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
8K