Blue @^ text

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Blue @^ text

Pete T
Hey there.

Apologies if this is an extremely basic question, but I've begun
learning C using MacVim and I think it's brilliant. However, when I
load up programs, instead of appearing as code, it is showing up as
non-sensical (I think) letters, and @^@^@^@^@^@^ in blue. I've not
been able to find any other topic on this from what basic terms I
know.

Any help would be wonderful.

Thanks,
Peter.

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Blue @^ text

Anton Klava
Hi Peter!

Could it be that you are loading a binary (compiled) file? 
This is what it looks like for me if I'm loading a binary file: http://i41.tinypic.com/21297oi.jpg
Make sure that you are loading the correct .c file.

Hope that helps!

Anton Klava
[hidden email]

28 nov 2011 kl. 20:40 skrev Pete T:

Hey there.

Apologies if this is an extremely basic question, but I've begun
learning C using MacVim and I think it's brilliant. However, when I
load up programs, instead of appearing as code, it is showing up as
non-sensical (I think) letters, and @^@^@^@^@^@^ in blue. I've not
been able to find any other topic on this from what basic terms I
know.

Any help would be wonderful.

Thanks,
Peter.

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Blue @^ text

Kyle Lippincott-2
In reply to this post by Pete T
Similar apologies if this response starts from 0 assumptions :)

1: You're opening up a .m, .h, .c, .cpp, .cxx, etc. file, right?  You can't open up compiled programs in MacVim (so things in /Applications aren't likely to be useful to open).

2: Do you know what Unicode is?  ^@ usually indicates a NULL byte, which UTF-16 inserts to pad characters to 16 bits.  If the file looks like the expected C code, but there's just ^@ in-between each character, this is what's happening.  For portability, I don't recommend storing code in UTF-16; you should probably use UTF-8 or a non-unicode file format, but that's not directly related to the current issue :).  You can try this, to see if it loads in utf 16:
:e ++enc=utf16 path/to/file.c

3: I don't know if vim does automatic byte-order determination, so if the suggestion from #2 doesn't work (the file looks like a bunch of chinese characters with random symbols throughout), also give this a shot:
:e ++enc=utf16le path/to/file.c

If you determine it's in utf-16 and it loads and shows fine in vim with the above option, I think that you can have vim save it as utf-8 (so that you don't need to worry about it anymore) for you by running:
:save ++enc=utf8 new/path/to/file.c


On Mon, Nov 28, 2011 at 11:40 AM, Pete T <[hidden email]> wrote:
Hey there.

Apologies if this is an extremely basic question, but I've begun
learning C using MacVim and I think it's brilliant. However, when I
load up programs, instead of appearing as code, it is showing up as
non-sensical (I think) letters, and @^@^@^@^@^@^ in blue. I've not
been able to find any other topic on this from what basic terms I
know.

Any help would be wonderful.

Thanks,
Peter.

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Blue @^ text

David Henderson
In reply to this post by Pete T

On 28 Nov 2011, at 11:40, Pete T wrote:

> Apologies if this is an extremely basic question, but I've begun
> learning C using MacVim and I think it's brilliant. However, when I
> load up programs, instead of appearing as code, it is showing up as
> non-sensical (I think) letters, and @^@^@^@^@^@^ in blue. I've not
> been able to find any other topic on this from what basic terms I
> know.

Sounds like you’re opening the compiled object or program file. What you’re seeing is a binary file represented as character bytes. In order to see the “program code” you’ll need the source file which in C has either a .c or .h extension. Those will be text files and meaningfully editable by MacVim (or any other text editor). If you really want to examine the actual program binary, you’ll need a different tool like a hex editor or one that can “decompile” the object code into text.

David P Henderson
c: xxx.xxx.xxxx
--
"Never attribute to malice that which can be adequately explained by stupidity."
    -- Robert J. Hanlon

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: Blue @^ text

Pete T
Thanks a lot for the suggestions, guys.

Thanks to your help I found out what was wrong, and boy do I feel like
a fool.
I was trying to open the compiled code rather than the .c file that I
was working on. Thankfully everything seems fine now and I'll be
double sure to check the basics in the future.

Very grateful,
Peter.

--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php