How can I declare and define a function so that it is only accessible from a single function? I can declare a function in another function. But since local function definitions are illegal (according to Visual C++) I must define the function at global scope, making it possible for other functions to call it.
void f1() {
void f1_priv...
I'm currently working on a project where I need to track the usage of several system calls and low-level functions like mmap, brk, sbrk. So far, I've been doing this using function interposition: I write a wrapper function with the same name as the function I'm replacing (mmap for example), and I load it in a program by setting the LD_P...
There is a piece of code:
int p(char *a, char*b)
{
while (*a | *b)
{
if (*a ^ *b)
//...
}
}
and I don't really know what it's doing.
Edit: I understand what the | and ^ operators do, I just don't know what they'll do with char values.
...
i am designing a compiler in c . but for certain problems like big integers i have to code in assembly code . so how can i integrate assembly code in c?
i am wrting my code in dev cpp.. which i suppose uses gcc ... in windows..!!..
pls give me instructions for linux too
...
If you have 65536 random English words with length 1-32 per word that you need to count for appearance and sort based on dictionary or appearance rank, how do you structure the data and what sorting technique would you use to process it the fastest?
...
Hello,
I need to define an array statically (in a *.h) file of size 12884901888 like.
unsigned char sram[12884901888]; //All of my code is C.
Above declaration gives error and does not work.
Because constants used in array declarations are unsigned int. But the constant i need to use (12884901888) is larger than the unsigned int lim...
i am very weak in pointers , blame it on not having access to some good books .. while designing a compiler in c , how important is it to have a good knowledge about pointers?.. any good books??
...
In some code that I have to maintain, I have seen a format specifier %*s . Can anybody tell me what this is and why it is used?
An example of its usage is like:
fprintf(outFile, "\n%*s", indent, "");
...
I have a C library that needs a callback function to be registered to customize some processing. Type of the callback function is int a(int *, int *).
I am writing C++ code similar to the following and try to register a C++ class function as the callback function:
class A {
public:
A();
~A();
int e(int *k, int *j);
};
A::A(...
Hello,
Assume if I have an array of size 78719476736 bytes. mind you that this array is dynamically allocated using malloc in my C code. Assume malloc returns a valid pointer after allocating this much memory. The size of this array is more than UINT_MAX(4294967295) , i.e. max limit of a unsigned int(32 bits)
Assume my code looks like ...
Is there a programmatic way to detect whether or not you are on a big-endian or little-endian architecture? I need to be able to write code that will execute on an Intel or PPC system and use exactly the same code (i.e. no conditional compilation).
...
Hello,
From a C program on Windows we need to read and write like a Java bytebuffer which stores binary in BIG_ENDIAN
The algorithm is described at :
http://mindprod.com/jgloss/binaryformats.html
Need to read and write int and float.
Does anyone have example c or C++ code that does this or a reference ?
TIA,
Bert
...
When I scp a file, I can stop it with ^Z and put it in the background. When it's in the background it stops printing its progress but the copying continues. If I foreground it again, it resumes printing. How does it know? SIGTTOU? does that happen on a standard ptty?
...
I'm trying to develop/port a game to Android, but it's in C, and Android supports Java, but I'm sure there must be a way to get a C app on there, anyone knows of a good tutorial on the subject?
Thanks!
...
I want to launch a process from within my c program, but I don't want to wait for that program to finish. I can launch that process OK using system() but that always waits. Does anyone know of a 'non-blocking' version that will return as soon as the process has been started?
[Edit - Additional Requirement] When the original process has ...
the scenario is: I get datetime in format "YYYY-MM-DD HH:MM:SS" with libexif. To minimize the saving cost, I wanna convert the datetime to unix timestamp or alike which only cost 64bit or 32bit. Is there any explicit way with c?
...
Is there any downside to calling pthread_cond_timedwait without taking a lock on the associated mutex first, and also not taking a mutex lock when calling pthread_cond_signal ?
In my case there is really no condition to check, I want a behavior very similar to Java wait(long) and notify().
According to the documentation, there can be ...
Hi,
I'm looking for a way to remove the background of a 24bit bitmap, while keeping the main image totally opaque, up until now blending has served the purpose but now I need to keep the main bit opaque. I've searched on Google but found nothing helpful, I think I'm probably searching for the wrong terms though, so any help would be gre...
Hello;
I'm having a hard time figuring this problem out - I am trying to write a program that will interact with the Linux tunnel driver. At a very basic level, I simply want to create an application that is able to transfer data over a network tunnel. However, I am completely at a loss as to how to properly set up the tunnel driver i...
Hello,
My cousin is actually asking me if it's still available but I can't find that version, since it's too old, he's complaining about version 5.5 saying that it doesn't recognize his libraries. Is there any link? I doubt but I thought I'll give it a shot. 0.7 is way too old i know :D
thank you.
...