In working on a logfile for an application, I needed to limit the size of the logfile to 1000 bytes. Since it is not possible to delete lines from a file in C++, I used the following steps: Rename the logfile to a temporary name. Read the temporary file. Write the last 1000 bytes to a new logile. Delete the temporary file. I tested my code on another machine (location: Desktop) and it worked perfectly. When I tested the exact same code inside the application (location of the logfile: /var/HHPVideoServer/log.txt, application is run as sudo), it has no effect. Here …

Member Avatar
Member Avatar
+0 forum 3

Hi every one, I am currently working on a server program which executes a series of system commands on receiving a messgae from the client(in C). what the server essentially does is he cd's into a particular directory and executes a shell script that calls make utility and does some other functions. I want to intimate the client whether the make utility was successful in building the source code. Currently i am using the system function in C to execute the shell script. I know that make return a value of zero if the build was successful. My problem is …

Member Avatar
Member Avatar
+0 forum 1

Hi, I was honing my linux programming skill when this nuisance started bugging me. I wanted to create an empty file creator program. While creating a large file it must print # for progress bar. But the output shows it happening reverse way. ie. first it copies file and shows the progress bar(although the bar is filled completely thus showing that parent process is working correctly). Kindly help me in putting these progress # simultaneously to file copying. Thanks in advance. Code: [CODE] #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> static int status …

Member Avatar
Member Avatar
+0 forum 3

The End.