Can anyone please help me to point out as what is the error in my program? Thanks in advance, kingsmasher1 Output: msgsnd failed: Invalid argument Answer You do not have enough space in your buf.mtext (15 characters) for “This is a test message” (23 characters plust one more for a NUL terminator).…
Tag: c++
what are advantages and limitations of using mono project to run c# code on linux?
If anybody having the solution of advantages and limitations of using mono project to run C# Code on Linux, Please tell me your thoughts… Answer There’s a huge advantage – it works. You can use C#, develop, and run on Linux (and other platforms, including Windows). The disadvantage is that t…
Paint Pixels to Screen via Linux FrameBuffer
I was recently struck by a curious idea to take input from /dev/urandom, convert relevant characters to random integers, and use those integers as the rgb/x-y values for pixels to paint onto the screen. I’ve done some research (here on StackOverflow and elsewhere) and many suggest that you can simply wr…
Sharing memory between processes through the use of mmap()
I’m in Linux 2.6. I have an environment where 2 processes simulate (using shared memory) the exchange of data through a simple implementation of the message passing mode. I have a client process (forked from the parent, which is the server) which writes a struct(message) to a memory mapped region create…
What are the GCC default include directories?
When I compile a very simple source file with gcc I don’t have to specify the path to standard include files such as stdio or stdlib. How does GCC know how to find these files? Does it have the /usr/include path hardwired inside, or it will get the paths from other OS components? Answer In order to figu…
using C code to get same info as ifconfig
Is there a way in Linux, using C code, to get the same information that “ifconfig eth0” would return? I’m interested in things like IP address, link status, and MAC address. Here’s sample output from ifconfig: Answer Yes, ifconfig itself is written in C. 🙂 See: http://cvsweb.netbsd.org…
Why are designated initializers not implemented in g++
Is there any specific reason why has support for designated initializers not been added to g++? Is the reason that C99 standards came late and g++ was developed earlier and later people didn’t care about this issue, or there is some inherent difficulty in implementing designated initializers in the gram…
Resetting an ostream, C++
I have 2 different ostreams, one of them cerr, using the same streambuffer, I have some libraries in that might have modified cerr somehow,(flags? format modifiers?). prints: Debugging mystreambuffer I’ve noticed that cerr calls mystreambuffer->sync() every << operation while teststream does no…
Socket data length questions
I have a couple of questions related to the following code: The questions: Why I read 255 not 256 ? Let’s say I want to send the word: “Cool” from the client to the server. How many bytes should I write “in client” and how many bytes should i read “in the server”? I&#…
I cannot get stdout to update in Qt
I need to call an executable, from my QT application, monitor the output and then display the out put in a text browser. The executable I call from my QT app will run for many hours (~12) and each time the executable spits something out to stdout, I need to parse the output to be able to monitor its progress,