Problem with `cat` the compiled output of C program in unix
Hello All,
I have coded a C program which looks something like below... (program name: test.c)
when compile this in unix by using the below command
I will get the compiled output as a.out which i need to give to my team members...
Now My problem is....! If someone by mistake try to see what is there inside the a.out by using cat a.out
it will start to BEEP and will not stop for while... I dont want this to happen... it should just show the weird language inside the a.out file without any sound....how can i do that?
Thank you.
Regards,
smarty86.
---------- Post updated at 06:59 AM ---------- Previous update was at 05:54 AM ----------
And also one more thing I'm using HP-UX m/c.. so zip is not working in that..
try
Why don't you just send the C code to your friends -- ? Let them compile.
whatever.. even if they compile and then they do cat of the compiled file the same thing happens... i dont want that BEEP to come... so.. please help me
The beeps are generated by the console/terminal emulation, trying to interpret the bytes output by cat. cat faithfully prints whatever is in the file. The file is a collection of opcodes, which you can't change unless you switch to a different architecture, but even then there'll be codes that will make your system beep.
In short: unless your colleagues run (not available on every UNIX)
first, outputting the compiled code will almost always beep.
Off topic. Beware of calling a program "test". It is the name of a unix command.
Maybe tell your colleagues about the "file" command which will tell them whether a file is "text" and therefore suitable for reading with "cat".
The beep usually comes from a byte containing Hex 07 - meaning a terminal bell character in a text file (which program object code isn't).
Will a program compiled in ubuntu 14.04 execute in Centos 7? That is to say a tarball or zip is downloaded from github and extracted, compiled, and make is all done in ubuntu 14.04, can I mv the program from ubuntu 14.04 to Centos 7, add it to path in Centos 7. And run it? Thank you :) (3 Replies)
I have a file
# cat /root/llll
11
22
33
44
When I cat this file content to a variable inside a shell script and echo that shell script, it does not show up as separate lines. I need echo output similar to cat.
cat /root/shell_script.sh
#!/bin/bash
var=`cat /root/llll`
echo $var (2 Replies)
I have put some yellow color codes and works well.
I call the funstion using
print_usage(stderr, 0);
I would like to know if there is any way, to store the ansi color codes in variables and then call them inside fprintf.
Or have a format followed by the strings I want to output.
... (5 Replies)
Hi,
We upgraded our servers from solaris 9 to 10. We recompiled all the Pro*C programs with the new oracle version as well. Oracle is 11g. We are facing core dump with the below error for certain executions. But when we are placing new statements between the error fucntion we get junk values to... (1 Reply)
Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
I am trying to make an application which works on unix to work on linux. I already tried copying the binary files and start it up but I am getting an error stating "Cannot execute binary file". Then I tried to recompile but i am getting an error whenever I tried to recompile. I am getting the... (1 Reply)
Hello experts,
How can I retrieve the output from a Unix command and use it as string variable in my C program?
For example, when I issue the command 'date' I get:
Tue Jun 11 09:54:16 EEST 2009
I do not want to redirect the output of the command to a file and then open the file from... (3 Replies)
hi,
i searched the forum, but found no thread relate to this; so sorry if it's duplicated.
I'm using unix cat command but it gives no output. I check permission, owner and group; all of which are OK. I could do less and vi.
any suggestions?
thanks, (2 Replies)
I am confused about how to use a .exe file in unix along with a compiled C++ program. I've been using emacs and I compiled with g++, but I have no idea how that relates to use with a .exe. (1 Reply)
Just getting into the Unix command line programming and am unable to run any program I write. I am using a Makefile and the source is compiling but when I enter the name of the output file I get back:
bash: lab01exe.out: command not found
I'm sure I am just dooing something simple... (2 Replies)