linux

How to obtain total available disk space in Posix systems?

Hi! I'm writing a cross-platform application, and I need the total available disk space. For posix systems (Linux and Macos) I'm using statvfs. I created this C++ method: long OSSpecificPosix::getFreeDiskSpace(const char* absoluteFilePath) { struct statvfs buf; if (!statvfs(absoluteFilePath, &buf)) { unsigned long blksize, ...

mingw g++ cant see sdl-config

All works good if I insert sdl-config output manually. How to fix this bug? g++ -O3 -c 'sdl-config --cflags' test.cpp g++.exe: sdl-config --cflags: no such dile or directory ...

Duplicate Visual Studio's memory violation detection on Linux

I developed a command-line (non GUI) C program on Linux using QT Creator, which internally uses gdb as its debugger. When I debugged the program on Windows using Visual Studio, it reported that it was writing outside the bounds of allocated memory (although it did not report the violation at the exact time it occurred, so it was still h...

Linux distribution vulnerable to buffer overflow

i need to demonstrate Buffer overflow in class.Could anyone suggest me distribution and the place where i can download it from. i tried DVL,but it doesnt provide the desired output. ...

Current right way to do thread programming in Linux

I know that the implementation of threads in the Linux kernel and libc went through big changes in the past. What is the best way to use threads today from C programs? (I don't even know if there is more than one API that I can use -- I just know pthreads) I don't care too much about old kernels and libc versions, but I do care about ma...

Can't compile 32bit with 64bit g++

I'm using codeblocks. I'm using ubuntu. Here is output of compilation. g++ -Wall -O2 -m32 -nostdlib -Iinclude -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Component.cpp -o obj/ReleaseCGI32/src/WEBGINE/Component.o g++ -Wall -O2 -m32 -nostdlib -Iinclude -c /home/miroslav/Development/WEBGINE/src/WEBGINE/Debug/ComData.cpp -...

Get sound level from device while recording in C++

I want to get sound level, so I can display it in my SDL application (the platform is Linux) when recording sound. How can I do that? I use FMOD API in my app, but for recording, I'm using SoX (forking and using exec() to set it up - probably this could be done better but I don't know how :( ). Should I use some function of SoX, FMOD API...

send keyboard input to a running process linux

I am developing web interface for an mp3 player (mpg123 linux). The mpg123 is a command-line mp3 player and can be controlled using keyboard inputs. For example: $ mpg123 -C filename.mp3 it will start playing the song and monitor keyboard inputs for control. Pressing 's' will pause the song 'q' for quit etc. I am spawning an mpg123 p...

How to sort files into folders by filetype on bash (with 'file' command)?

I have thousands of files without extensions after recovery (mostly pictures). I need to sort them into separate folders by filetype (folders must be created during sort process). I can determine filetype in linux using "file" command. Does somebody have bash script for it? For example: Initial dir contains files: 001, 002, 003, 004. A...

understanding shared libraries using gcc

I am trying to understand the following behavior of shared libraries in C Machine One $ cat one.c #include<stdio.h> int main() { printf ("%d", 45); } $ gcc one.c -o one -O3 $ ldd one linux-gate.so.1 => (0x00331000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00bc2000) /lib/ld-linux.so.2 (0x006dc000) $ cat two.c ...

Permanently reversing a patch-file

Sometimes, for whatever reason, I have to produce patch-files (under Linux) that are in the wrong direction. I know that I can deal with this by using the -R switch when applying it via patch, but it would be nice if there were a way of permanently reversing the patch-file. Is there a utility that can do this, or e.g. a regex that woul...

Linux: packets reordering simulation

I would like to simulate packets reordering for UDP packets on Linux to measure the performance and fault tolerance of my application. Is there a simple way to do this? ...

Linking with new version of libpcap library

Hello, I would like to install and use latest version (1.1.1) of the libpcap on CentOS 5.5 machine. I configured, compiled and installed new libpcap library by: [dima@localhost libpcap-1.1.1]$ ./configure [dima@localhost libpcap-1.1.1]$ make [dima@localhost libpcap-1.1.1]$ sudo make install But when I'm trying to link with libpcap sh...

Linux traceroute Countries

Okay I was searching now for quite some time and I can't believe it. Is there no traceroute that shows me the hops on a world map? And maybe in a 64bit version I found xtraceroute, grace, GTrace... but they are all a little bit rusty. Maybe I'm just too stupid Anybody knows something ...

PyBluez - How can I find the signal strength between me and a device?

I'm looking into making a Python app that utilizes the PyBluez module to scan for devices and log their MAC address and signal strength. From looking at (code.google.com/p/pybluez/source/browse/trunk/examples/simple/asynchronous-inquiry.py), it seems very easy to scan for the devices and get their MAC address. What I can't find how to d...

Record frames from X11 into a file

I think there should be some sort of internal support on screen capture utilities with X11. So how can capture frames from X11 frame-buffer into a file eg. avi, jpeg etc.? Sultan ...

Linux shell running programming simultaneuosly

I need to run a programmme, let say ./a for 10 times in the linux shell. What is the command to do that? Also, how could I differentiate the output from different processes? Besides, my ./a is a continual process. How could I terminate it? Thanks. ...

Print open office document to PostScript-file from command line

Hi, I need to convert an open office document in to PostScript file. My first solution was to use spadmin to define a virtual printer that use ghostscript to convert postscript file. (read more about it here http://www.oooforum.org/forum/viewtopic.phtml?t=72382). It works but the disadvantage is that I have to define a virtual printer ...

Installation for Mac and Linux on a windows machine

Hi all. I was wondering if there is anyway to create an installation for Mac and Linux using a strictly windows machine? I am developing a program that I will be attempting to make available on all three platforms through use of the Mono project (C#) and need to create installers for each one. Given my almost complete ingnorance (this ...

FTP Get works on windows but not on linux.

I am doing an FTP Get in Java with FTP Client which if I run on windows works fine but when I run the same on a linux box it get me the file with some modifications. I have a test.tar.gz file (bunch of text files) which is of size 2872578 but it shows up as 2872541 when I run my java program on linux. Anyone faced a similar problem? //...