Hi all,
I have a C++ library, which is used in both Linux and Windows.
I want to enable the user to control the debug level (0 - no debug, 1 - only critical errors ... 5 - informative debug information).
The debug log is printed to a text file.
In Windows, I can do it using a registry value (DWORD DebugLevel).
What can be a good repl...
Disassembling an ELF binary on a Ubuntu x86 system I couldn't help but notice that the code(.text) section starts from the virtual address 0x8048000 and all lower memory addresses seem to be unused.
This seems to be rather wasteful and all Google turns up is either folklore involving STACK_TOP or protection against null-pointer derefer...
I think the title says it all, however, I'll expand a bit.
Is there a difference between having the following code at the begining of program 'progX'
if(daemon(0, 0) == -1)
{
printf("daemon error: %s", strerror(errno));
}
or running 'progX' via the command: progX & 2>/dev/null 1>/dev/null 0>/dev/null
...
What are the best practices on writing a cross platform library in C++?
My development environment is Eclipse CDT on Linux, but my library should have the possibility to compile natively on Windows either (from Visual C++ for example).
Thanks.
...
Is it possible to create a file on a mounted SMB share that is hidden from Windows? The .(dot) prefix doesn't work in this case because that only works on Linux. Basically I'm looking for the same affect as using attrib +h on Windows, but under Linux.
...
Hi,
I want to merge lines such that the merged lines are aligned on the same boundary.
UNIX paste(1) does this nicely when lines all meet at the same tab boundary, but when lines
differ in size (in the file that lines are being merged into), the text comes out awkward.
Example of paste(1) that has the desired effect:
$ echo -e "a\nb\n...
Basically I want to spawn a process changing its working directory.
My idea was to spawn a process and set the PWD enviroment variable.
There's a way to obtain something like that?
(virtually I would like to change any of the environment variables for flexibility)
...
Hi,
I am currently writing my own shell program. My current shell can just execute commands.
I want to go a step future and execute vi from this new shell. I am trying to understand the internals of how a vi editor works , but no good articles on net.
Any pointers or links would be helpful.
Thanks
...
We have a C++ Gtk application that currently has a "homebrew" reporting component. We're looking to step up to a more fully-featured reporting library, preferably with a WYSIWYG designer, print-preview / GUI viewer, and PDF export capabilities.
Any recommendations?
...
int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);
I'm a little confused about the maxevents parameter. Let's say I want to write a server that can handle up to 10k connections. Would I define maxevents as 10000 then, or should it be be lower for some reason?
...
Using pdftk to merge multiple pdf's is working well. However, any easy way to make a bookmark for each pdf merged?
I don't see anything on the pdftk docs regarding this so I don't think it's possible with pdftk.
All of our files merged will be 1 page, so wondering if there's any other utility that can add in bookmarks afterwards?
O...
The linux kernel (and various other projects including git) have very nice makefiles that hide the giant cc calls into nice little acronyms.
For example:
gcc -O2 -o cool.o cool.c -llib
gcc -O2 -o neat.o neat.c -llib
would become:
CC cool.c
CC neat.c
Which is really nice if you have a project with a large number of files and long c...
Hello guys,
Currently, I'm implementing a simple shell in C language as my term project. I used fork and exec to execute the commands. However, some commands must be executed internally (fork and exec aren't allowed).
Where can I find the source code for the shell commands?
...
Hi,
Is there an alternative to scp, to transfer a large file from one machine to another machine by opening parallel connections and also able to pause and resume the download.
Please don't transfer this to severfault.com. I am not a system administrator. I am a developer trying to transfer past database dumps between backup hosts and ...
I have been experimenting with async Linux network sockets (aio_read et al in aio.h/librt), and one thing i have been trying to find out is whether these are zero-copy or not. Pretty much all i have read so far discusses file I/O, whereas its network I/O i am interested in.
AIO is a bit of a pain to use and i suspect is non-portable, so...
I'm trying to route watir through a proxy pragmatically -- this means within the script I'd like to change my proxy dynamically before launching the browser.
Here's what I've tried so far (and so far am failing):
I'm running chrome and lucid lynx ubuntu. I chose TREX cause I thought watir might be making use of PROXY or something.
I re...
Hi,
I am learning how to program in Linux OS platform and what is the implementation to run my app in background process.
Like for example in this scenario: When executing my app in the shell it will automatically run in background process. Take note that I don't need the "&" in the shell when I run my app. What standard Linux function...
Hello to everyone!!
I am trying to print the MAC address by using ether_ntoa. When i try to do
printf("MAC (src): %s\n",ether_ntoa((struct ether_addr *)&eheader->ether_shost));
I get a segmentation fault, so I have come up with two different approaches:
This is the snippet code nº1:
struct ether_header *eheader;
char *p;
...
p = et...
Ok, this is just out of curiousity, but why does the sleep function NOT work in a loop, or how can I Get it to work in a loop?
for(int i = 0; i < 5; i++) {
cout << i << endl;
sleep(2);
}
...
I have a system that uses C methods as functions in a Postgres database. When I try to run gdb with my user account I get this:
ptrace: Operation not permitted
It looks like a permission thing. It seemed to work when I ran gdb as the "postgres" user. I would like to continue running postgres as the "postgres" user and not have to su ...