Search Results

Search: Posts Made By: techmonk
1,282
Posted By techmonk
I am actually calling sleep with 1 second in a...
I am actually calling sleep with 1 second in a loop, instead of 60 seconds to check if the command has already completed its execution.
1,282
Posted By techmonk
Command timed out implementation
I have a running service which runs in background.
It execute shell commands by function system(cmd)
I need to report fail when command execution takes more than 60 seconds.
Parent doesn't need to...
Forum: Programming 03-17-2016
16,351
Posted By techmonk
Go for multi-line statement
Go for multi-line statement
Forum: Programming 02-12-2016
2,801
Posted By techmonk
Function call setsid() doesn't work if the...
Function call setsid() doesn't work if the calling process has a control terminal. This is usually done in background daemon processes. After calling setsid, the process becomes the process group...
Forum: Programming 08-03-2015
2,375
Posted By techmonk
A single statement without main function in c
A sample.c file is written with only one single statement.
main;
Segmentation fault occurred when executed that file.

Any statement other than main; is written, for example unix; then it won't...
Forum: Programming 06-26-2014
4,381
Posted By techmonk
std::ofstream.is_open()
std::ofstream.is_open()
1,558
Posted By techmonk
sed 0,/white/{s/white/black/} filename
sed 0,/white/{s/white/black/} filename
Forum: Programming 06-19-2014
8,811
Posted By techmonk
MCC_T_SYS_ADDRINFO *iter = ipc->addr_ptr; ...
MCC_T_SYS_ADDRINFO *iter = ipc->addr_ptr;
MCC_T_SYS_ADDRINFO *newloc;

copy( &iter, &newloc);

copy(MCC_T_SYS_ADDRINFO **src, MCC_T_SYS_ADDRINFO **dst)
{
while( *src != NULL )
{
//1....
1,331
Posted By techmonk
using cut command
echo "/a/bc_de/fe_rt/ghl/CW_CA_CA_20140128_150752.xml" | cut -d / -d _ -f 6,7 | cut -d . -f 1
Forum: Programming 05-23-2014
4,300
Posted By techmonk
Modifying the myfunc function changing data->type...
Modifying the myfunc function changing data->type inplace of s->type


void myfunc(S *data)
{
switch(data->type) {
case TYPE_DS:
data->ds.dc=0;
...
3,969
Posted By techmonk
The "record - locking" concept ensures, one copy...
The "record - locking" concept ensures, one copy of process is running. If each daemon creates a file and places a write lock on the entire file, only one such write lock will be allowed to be...
Forum: Programming 05-08-2014
1,749
Posted By techmonk
void deleteLastNode(struct list *itr) { ...
void deleteLastNode(struct list *itr)
{
struct list *tmp;
if( itr )
{
while( itr->next != NULL )
{
tmp = itr;
itr = itr->next;
}
free(itr);
...
Forum: Programming 04-18-2014
1,117
Posted By techmonk
You may use a struct, for grouping the bolean...
You may use a struct, for grouping the bolean variable and integer varaible.
Suppose,

struct strct_value_bool{
int x;
bool bl;
};
std::map<String str, strct_value_bool> myMap;
Forum: Programming 02-20-2014
1,174
Posted By techmonk
Size of derived class, in case of multiple inheritance
Why, here the size of class 'Derived' is 8 ?

class Base1
{
public:
virtual void f() { }
};
class Base2
{
public:
virtual void f() { }
};
class Derived : public Base1, Base2
{
...
Forum: Programming 02-14-2014
4,635
Posted By techmonk
Replacing a word of a text file, in C++ fstream
How to replace a word in text file using c++ fstream. Is there a way, without creating any temporary file. Could you please share pseudo code ???
Forum: Programming 01-29-2014
1,533
Posted By techmonk
How to initialize an object with another object of different class?
How to initialize an object of class say "A", with an object of type say "B".
The following code give the error message "error: conversion from âAâ to non-scalar type âBâ requested"

#include...
Forum: Programming 12-20-2013
1,223
Posted By techmonk
How to avoid dangling pointers?
To get rid of dangling pointers, after freeing the pointer, can we assign NULL. Is this be an acceptable solution. Since free(NULL) won't do any operation.


main(){
void *ptr = malloc(10);
...
4,894
Posted By techmonk
"more" contains less and "less" contains more ......
"more" contains less and "less" contains more ... Funny to know.
Forum: Programming 10-22-2013
2,461
Posted By techmonk
Finally .. I think i got answer !!! its may be...
Finally .. I think i got answer !!! its may be because of virtual pointer in the derived class.
Forum: Programming 10-12-2013
2,461
Posted By techmonk
Size of Derived class, upon virtual base class inheritance
I have the two class definition as follows.


class A { public: int a; };

class B : virtual public A{ };



The size of class A is shown as 4, and size of class B is shown as 16. Why is...
Forum: Programming 10-11-2013
1,627
Posted By techmonk
Restricting member of a class non-inheritable in C++
There is base class B, and two derived classes D1 and D2 derived from Base. Base class B, have two data members ( public or protected or private or if any). D1 should inherit both these data members,...
1,911
Posted By techmonk
Try the command with following option. ipcs...
Try the command with following option.

ipcs -a


It supposed to show the output like following. Where perms is the numerical representation of modes.
777 is equivalent to RWXRWXRWX and
461 is...
2,029
Posted By techmonk
Perhaps this kind of model serves your purpose. ...
Perhaps this kind of model serves your purpose.
Every time fork a child process, where it loads the executable with index as argument.
Parent process continues looping on index value.

for(index...
2,029
Posted By techmonk
A successful exec call replaces the current...
A successful exec call replaces the current program with another program. We can't get back to the previous executable. If you want keep both processes, you may use vfork() and then exec().
1,006
Posted By techmonk
As per your code, main thread send only one int...
As per your code, main thread send only one int value to the "funktion1" thread.
After sending one int value, the main thread is modifying its value ten times.

If you want to send all 10 int...
Showing results 1 to 25 of 28

 
All times are GMT -4. The time now is 04:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy