C server returns only first message

I have a simple C server and simple Java client. Client takes input from keyboard and sends it to server. Server prints it and sends it back. But it works only for the first time, what can be the problem? Main: package test; import java.util.Scann...
more »

2017-01-11 21:01 (3) Answers

How does the stack works?

from what I understood the stack is used in a function to stock all the local variables that are declared. I also understood that the bottom of the stack correspond to the largest address, and the top to the smallest ones. So, let's say I have this...
more »

2017-01-11 18:01 (3) Answers

Check if Structure is empty C

My program is supposed to differenciate given measurements into cycles and then it to a file. The input file looks like this: reading | force | displacement | velocity 1 | 64.69 | 49.67 | 0.002 2 | 64.54 | 49.66 | 0.002 3 ...
more »

2017-01-11 12:01 (0) Answers

Is this a compiler bug?

My nearly microscopic 8051-based embedded system has a debug serial port, and I wrote a simple serial port output function that was working fine until I made a couple minor tweaks in it to reduce its memory footprint. Then the following line, which W...
more »

2017-01-10 19:01 (1) Answers

output different elements from two arrays

I am trying to output different elements from two arrays. So if i have an array A: {9, 0, 1} and B is {0, 8, 1}, I need to output an element which included in the first set, but are not included in the second :9 Can not think how I should compare all...
more »

2017-01-10 16:01 (4) Answers

unshare mount namespace not working as expected

When I call the Linux system function unshare(CLONE_NEWNS), it returns 0 indicating success. But, it doesn't seem to work as I was expecting. Specifically when I then add a new mount such as a tmpfs one, it is globally visible. Therefore it is in f...
more »

2017-01-10 05:01 (1) Answers

Cannot sort array a second time

I am not able to sort the numbers after second loop, the first group numbers get sorted but after that they just print the given numbers in same order. Ex-input: 2 4 67 90 76 89 3 67 45 1...
more »

2017-01-09 21:01 (0) Answers

libpcap: pcap_breakloop() causing memory leak

While working with Linux pthreads and libpcap I noticed some weird behavior when using pcap_breakloop. My goal is the following: Opening a new thread that will run pcap_loop and deal with captured packets, while the main thread will do other stuff. W...
more »

2017-01-09 18:01 (2) Answers

C Disable command-line input

I'm creating a ncurses program which reads system-wide keystrokes using AppKit. To clear the wall of text that accumulates on the command line while I run the program I execute this line of code before exiting the program. while((c = getch()) != '\n...
more »

2017-01-09 16:01 (2) Answers

How can I delete from a text file?

Hi guys I have a text file which is known as dictionary.txt. Basically i am doing a menu of two choices, 1. add new words to dictionary and 2. delete words from dictionary. right now i managed to do the menu and add new words. However, I am stuck at ...
more »

2017-01-09 13:01 (3) Answers

Linux sscanf function doesn't fill variable

I am currently writing an FTP server and I need to parse the ip and port of a remote server from an input string buffer in the following format: xxx,xxx,xxx,xxx,yyy,zzz where: xxx stands for an ip address octet in decimal yyy is round((remote po...
more »

2017-01-09 03:01 (3) Answers

Linking 32 bit files on 64 bit machine with ld

I am compiled my assembly files with nasm: nasm -felf32 test.nasm -o test.o I've done it on 64 bit OS. Now, I would like to link it with: My OS is Ubuntu. gcc -m32 test.o -o test but I cannot because I have not installed 32-bit libraries. I kno...
more »

2017-01-09 02:01 (0) Answers

VS2013: strtof doesn't set ERANGE?

In Visual Studio 2013, I have the following test code: #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main ( int argc, const char* argv[]) { static const char* floatStr = "3.402823466385...
more »

2017-01-09 01:01 (1) Answers