Jump to content

Writing to a file doesn't look right when reading it in Terminal


Recommended Posts

I'm having an issue where I'm writing to a file on the Mac with "Write to Text File". It looks like the platform-dependent way Labview is choosing to write each line is with a Carriage Return.

If I open the file from Textedit, everything looks great.

However, if I open the file from Terminal using "vi" or "cat", then I see a ton of ^Ms in the file and there are no newlines. I believe ^M is a Carriage Return whereas I want to view the file in Linux with only Line Feeds.

Anyone know what I would have to do to fix this?

Thanks in advance.

-dmp

Link to comment

QUOTE (dmpizzle @ Jan 9 2009, 04:28 PM)

I'm having an issue where I'm writing to a file on the Mac with "Write to Text File". It looks like the platform-dependent way Labview is choosing to write each line is with a Carriage Return.

If I open the file from Textedit, everything looks great.

However, if I open the file from Terminal using "vi" or "cat", then I see a ton of ^Ms in the file and there are no newlines. I believe ^M is a Carriage Return whereas I want to view the file in Linux with only Line Feeds.

Anyone know what I would have to do to fix this?

Thanks in advance.

-dmp

The LabVIEW Text Write function node has a mode selection (right click pop-up menu) called "Convert EOL". When activated the function will convert each instance of LF, CR, or LF/CR into the end of line identifier for the current platform. Each platform has its own native EOL with Mac using a CR, Unix a LF and Windows CR/LF. And I think that LabVIEW for Mac OS X still uses the CR as it is really a Carbon application despite the underlying Unix kernel.

When you want to write a text with specific EOL you have to format it accordingly and disable above mentioned option in the Write Text function.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.