This issue originally came up in a related question of mine where I was having trouble reading some bit of code. The answer turned out to be that this line
&((GLushort *)0)[3 * mesh.sBoneBatches.pnBatchOffset[batchNum]]
evaluates to be a pointer. And it's used in
glDrawElements(GL_TRIANGLES, i32Tris * 3, GL_UNSIGNED_SHORT, &((uns...
I'd like to calculate all the permutations of size Y of a set of size X. That is if I had (1,2,3) and want all permutations of size 2, 3P2, it would be (1,2) (1,3) (2,1) (2,3) (3,1) (3,2).
Both the GSL and C++ STL only provide xPx that I can see. Could someone point me at a C/C++ library which can do this or spell out a fast and memor...
other than getdomainname() is there any way to get the domain name on Linux without having to open and parse files in /etc?
Code is appreciated.
Thanks
...
Hello!
I wanted to write a standard stack in C but I am not sure if my stk_size() function could work on other platforms except for my 32bit pc. I read that its not good to cast a pointer to int.
But what could be a better implementation? I dont want to add a "size"-variable because its redundant in my eyes.
Here are some parts of the ...
Hello every one,
I am failed to find out the free e-books for c & c++ language. ( Specially e-balagurusami if possible )
Actually, I wanted to give this books for trainees for study & revision.
Would you help me to find the e-books for this?
Thanks in advance for helping me.
Sagar.
...
Do you know of a good open source financial library written in C (preferably) or C++?
I already looked at Quantlib, which seems too complicated for me, since I just want some basic computations (total cost of credit, all in-cost credit rate...)
Thank you very much!
...
Hey,
I have been learning C over the last two weeks, managed to get my head around pointers, arrays and structures.
I am looking to do a bit of socket programming on windows and was wondering if anyone has any websites with tutorials and examples or suggest books that teach network programming with winsock?
I have tried looking for so...
I have a waveform 64 samples long. If the sampling rate is 44100 hz, how can I play(loop) this waveform so that it plays arbitrary frequencies?
frequency = samplerate / waveform duration in samples
Therefore the frequency should be 689hz(44100/64). If I wanted it to be say, 65.41hz(C-2), I would have to do this:
65.41 = 44100 / x
Sol...
Hi, I'm writing a little wrapper for an application that uses files as arguments.
The wrapper needs to be in Unicode, so I'm using wchar_t for the characters and strings I have. Now I find myself in a problem, I need to have the arguments of the program in a array of wchar_t's and in a wchar_t string.
Is it possible? I'm defining the m...
So I have a problem that I don't really know how to go about. I was hoping maybe you could let me know how to deal with it.
I need to allocate N number of buffers in shared memory. Each buffer should be initialized to 0. Then I must fork N/2 number of child processes.
Each child(i) then writes value (i) into buffer (i), sleeps for one...
I have an array of values all well within the range 0 - 63, and decided I could pack every 4 bytes into 3 because the values only require 6 bits and I could use the extra 2bits to store the first 2 bits of the next value and so on.
Having never done this before I used the switch statement and a nextbit variable (a state machine like dev...
The problem is to statically allocate a buffer large enough to fit a printed double, formatted with %g at maximum precision. This seems like a simple enough task, bu I'm having trouble. The best I have come up with (assuming the number to be printed is x) is
char buf[1 + DBL_DIG + DBL_DIG + 1 + 1 + 1 + DBL_DIG + 1];
int len = sprintf(...
Hi All,
I'm trying to figure out a way for this to work:
NSString *searchCommand = [[NSString alloc] initWithFormat:@"cp -R /Volumes/Public/DirectoryToCopy* Desktop/"];
const char* system_call = [searchCommand UTF8String];
system(system_call);
The system() method does not acknowledge the specific string I am passing in. If I ...
I heard C, C++, Java uses two complements for binary representation. Why not use 1 complement? Is there any advantage to use 2 complement over 1 complement?
...
So I have this function that forks N number of child processes. However it seems to be forking more than specified. Can you tell me what I'm doing wrong?
Thanks
void forkChildren(int nChildren){
int i;
for(i = 1; i <= nChildren; i++){
pid = fork();
if(pid == 0)
printf("I'm a child: %d PID: %d\...
I do embedded software, but this isn't really an embedded question, I guess. I don't (can't for technical reasons) use a database like MySQL, just C or C++ structs.
Is there a generic philosophy of how to handle changes in the layout of these structs from version to version of the program?
Let's take an address book. From program versi...
I understand what static does, but not why we use it. Is it just for keeping the abstraction layer?
...
in C, i have this code piece:
int a;
a = 10 + 5 - 3
I want to ask: where is (10+5-3) stored at?
(As far as I know, a is located on stack, how about (10+5-3)? How does this rvalue get calculated?)
...
Lets say I have a c program where I use only stack variables, no dynamic variables (malloc, ...)
Is it possible to calculate how much memory my program will take during run time?
...
I wonder if stack size can grow like heap does during runtime?
...