hi i am a student and just start learning low level c programming.i tried to understand read() and write() methods with this program.
#include <unistd.h>
#include <stdlib.h>
main()
{
char *st;
st=calloc(sizeof(char),2);//allocate memory for 2 char
read(0,st,2);
write(1,st,2);
}
i was expecting that it would give segmen...
I have a for loop to get the list of PID's and kill each PID. I want to display the entire line of PS output and write it to the /tmp/outfile . But from each line of PS output each field(PID,PPID,...) is written along with a new line in the /tmp/outfile. So if PS output has three lines as output i want to log these three lines into ...
I am a Fedora12(GNOME) user. I recently started development in Linux. Most of the Linux system applications/utilities are written in c/c++. The problem i am facing is that how to integrate a downloaded source code with some IDE(e.g, Anjuta etc).
In simple words i want to know that, what is the best way to start development on some exis...
I want to automatically kick off a build whenever a file changes.
I've used autospec (RSpec) in Ruby and loved that.
How can this be done in bash?
...
Hi,
I'm using Linux OS as a programming platform. And I want to create a program that uses serial(/dev/ttyS0) port as a communication medium. I already know how to open, read, write and close the serial port using standard Linux function.
Now my question is how can I able to setup the serial port? What I mean is I want to change the se...
Appending can be done using tee command.
cat file | tee -a >> *
Is there a way to do a prepend/insertion?
Thanks.
...
I downloaded apache-log4j-1.2.16.zip unziped . renamed it as LOG4J_HOME and placed it in /home/appnetix folder which is my folder. Now I'm setting the classpath using terminal by the following command :-
[appnetix@Sanjeev ~]$ set classpath=%path%;LOG4J_HOME/log4j-1.2.16.jar;
& I got this
bash: LOG4J_HOME/log4j-1.2.16.jar: Permission den...
I'm working on application using the math computation. For my code I need to know how to cover all paths of code of libraries I'm using. The one of not covered yet is in k_rem_pio2 file. The kernel function have branch for ih==2 numbers and then ther is an
if(carry!=0) -z= scalbn(one,q0);
my question is for what number the i...
Hi,
I have a hosting package where I have a private Tomcat and I run Hudson. I wanted to start using Mercurial and BitBucket (which is fantastic btw), my problem is that Hudson or the Mercurial plugin doesn't bundle Mercurial in the same way it does Subversion and you have to point your plugin to your Mercurial install.
My hosting does...
I'm currently searching for an application or a script that does a correct word count for a LaTeX document.
Up till now, I have only encountered scripts that only work on a single file but what I want is a script that can safely ignore LaTeX keywords and also traverse linked files...ie follow \include and \input links to produce a corre...
I try to run an executable file on newly installed Ubuntu and I get this strange error
>./hadoop
hadoop : Not a directoryh
>hadoop
hadoop command not found
the first error says "directoryh", what is the reason for these messages
...
Linux uses COW to keep memory usage low after a fork, but the way Perl 5 variables work in perl seems to defeat this optimization. For instance, for the variable:
my $s = "1";
perl is really storing:
SV = PV(0x100801068) at 0x1008272e8
REFCNT = 1
FLAGS = (POK,pPOK)
PV = 0x100201d50 "1"\0
CUR = 1
LEN = 16
When you use tha...
I am attempting to install an application. During compilation it fails with the following error:
/usr/bin/ld: cannot find -lemu
I have installed the libemu library, and it now currently resides in /opt/libemu/. However, when I try and compile my application the library is not found. Is there any way to correct this?
EDIT: It also l...
Hey
I'm having hard time selecting from a file using a regular expression. I'm trying to replace a specific text in the file which is full of lines like this.
/home/user/test2/data/train/train38.wav /home/user/test2/data/train/train38.mfc
I'm trying to replace the bolded text. The problem is the i don't know how to select only the bol...
Hi,
I'm trying to execute a firmware upgrade while my programming is running in inittab. My program will run 2 commands. One to extract the installer script from the tarball and the other to execute the installer script. In my code I'm using the system() function call. These are the 2 command strings below,
system ( "tar zvxf tarbal...
I have a program which continually receives data from an external source and prints it to the terminal. I am now trying to create a GUI to display the received data. Is there some way for me to do this without changing the pre-existing code (that is the old code calls a print statement and what is printed gets displayed in the GUI)?
...
I'll often create a file of a particular size with a trick like
dd if=/dev/zero of=1gb.dd bs=1M count=1024
or perhaps even
dd if=/dev/urandom of=1gb.dd bs=1M count=1024
dd if=/dev/random of=1gb.dd bs=1M count=1024
But what if I want to get all 1's instead of 0's or random?
...
I have a linux process but I am taking some core dumps some times.
Simple question: Is there any way/method/program/whatever that is capable of restarting a
process that got killed?
Thanks.
...
If I rm -rf a folder that has soft links in it, will it try to follow those links and delete the corresponding folder, or will it simply unlink them?
I have a copy of my home directory with sym links in it, and I'm scared to rm -rf it in case it follows those links and blows up the corresponding folders...
...
I tried to switch from Java 5 to Java 6 using the "update-java-alternatives" command like explained on this page: https://help.ubuntu.com/community/Java
But afterwards I get the following error when I tried to execute java:
root@webserver:~# java
Error occurred during initialization of VM
Could not reserve enough space for object heap
...