c

Problem with converting compressed swf with cws2fws...

I am trying to convert compressed swf files to uncompressed swf files using the cws2fws utility written by Alex Beregszaszi and which is part of the ffmpeg set of conversion routines. The compressed files I am using are valid files as they can be opened and played by Firefox and other programs, but when I run them through cws2fws the pr...

Is there any trick to handle very very large inputs in C++?

A class went to a school trip. And, as usually, all N kids have got their backpacks stuffed with candy. But soon quarrels started all over the place, as some of the kids had more candies than others. Soon, the teacher realized that he has to step in: "Everybody, listen! Put all the candies you have on this table here!" Soon, ther...

How does C allocate data items in a multidimensional array?

I'd like to find out how C will allocate a the data items of a multidimensional array, and if their allocation is consistent across machines. I know that, at the lowest level, the data items are neighbours, but I don't know how they're arranged further up. For example, if I allocate a 3D array as int threeD[10][5][6], can I assume that...

variable + value macro expansion

I tried without any result. My code looks like this: #include "stdafx.h" #include <iostream> #define R() ( rand() ) #define H(a,b) ( a ## b ) #define S(a) ( # a ) #define CAT() H(S(distinct_name_), R()) int main(int argc, _TCHAR* argv[]) { std::cout << CAT() << std::endl; std::cout << CAT() << std::endl; std::cout << CAT...

Embeddable Debugger for C++

Does not need to be a full debugger but i need to get a good stack trace dump when an assert is raised. A simple list of called functions is not enough. I'm pretty happy with my Eiffel system which is giving me something like 17 frames in current stack. ===== Displaying only top 10 frames in run-time stack ===== agent call wrapper 2 ...

Efficiency of C vs Assembler

Hi all, How much faster is the following assembler code: shl ax, 1 Versus the following C code: num = num * 2; How can I even find out? ...

How would you solve this math equation for x in C++/C

Solve this equation for x, (1 + x)^4=34.5 . I am interested in the math libraries you'd use. the equation is MUCH SIMPLER (1 + x)^4=34.5 thanks ...

Should useless type qualifiers on return types be used, for clarity?

Our static analysis tool complains about a "useless type qualifier on return type" when we have prototypes in header files such as: const int foo(); We defined it this way because the function is returning a constant that will never change, thinking that the API seemed clearer with const in place. I feel like this is similar to expli...

Instruct GDB 6.5 to use source embedded in object file

Hi All! I've been trying to make GNU gdb 6.5-14 to use the source code embedded on the object file when debugging, instead of scanning some directories for it. The main reason is that I develop for an embedded platform and I cross compile, which means that all the source is in my computer. I read about the -ggdb3 flag, that includes a...

How can I pass a pointer to an integer in C#

I have a C API with the signature: int GetBuffer(char* buffer, int* maxSize) In C, I will call it this way: char buffer[4096]; int maxSize = 4096; GetBuffer(buffer, &maxSize); maxSize is set to the buffer size, and set with the actual size filled. I need to call it from C#. How do I do that under "safe mode"? Thanks ...

Pointer Dereferencing = Program Crash

unsigned int *pMessageLength, MessageLength; char *pszParsePos; ... //DATA into pszParsePos ... printf("\nMessage Length\nb1: %d\nb2: %d\nb3: %d\nb4: %d\n", pszParsePos[1],pszParsePos[2],pszParsePos[3],pszParsePos[4]); pMessageLength= (unsigned int *)&pszParsePos[1]; MessageLength = *((unsigned int *)&pszParsePos[1]); //Program ...

Variable number of parameters in function in C++

How I can have variable number of parameters in my function in C++. Analog in C#: public void Foo(params int[] a) { for (int i = 0; i < a.Length; i++) Console.WriteLine(a[i]); } public void UseFoo() { Foo(); Foo(1); Foo(1, 2); } Analog in Java: public void Foo(int... a) { for (int i = 0; i < a.length; i+...

MATLAB engine versus libraries created by MATLAB Compiler?

To call MATLAB code in C or C++, how do you choose between using the MATLAB engine and using the MATLAB Compiler mcc to create C or C++ shared libraries from your MATLAB code? What are their pros and cons? For the second method, see http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/f2-9676.html Are there other ways to call ...

In C: How to set a pointer to a structure member that is an array?

How should I write my code to example a specific array index of an array that happens to be a member of a structure? The following code is giving me problems. // main.c void clean_buffers(void); // prototype struct DEV_STATUS { unsigned char ADDR; unsigned char DEV_HAS_DATA; unsigned char ETH_HAS_DATA; unsigned char D...

Opaque pointers in F77

I have a project that is half in C and half in Fortran 77. [No, not Fortran 90 or 03, Fortran 77.] The code would be much cleaner if I could pass pointers generated on the C side back to Fortran, which would then pass them back as necessary for handling in other C functions. As it is, the C code is filled with global variables that shoul...

std::pow gives a wrong approximation for fractional exponents

Here is what I mean trying to do double x=1.1402 double pow=1/3; std::pow(x,pow) -1; result is 0 but I expect 0.4465 the equation is (1 + x) ^3= 1.1402, find x. ...

Read In Hex Values (C)

Hello all. I am currently attempting to read in Hex values from a text file. There can be multiple lines of Hex's and each line can be as long as needed: f53d6d0568c7c7ce 1307a7a1c84058 b41af04b24f3eb83ce Currently, I put together a simple loop to read in the Hex values into an unsigned char line[500] with fscanf as such: ...

what is the official name of C++'s arrow (->) operator?

I think the subject says it all. I always call it the "arrow operator", but I'm sure it has an official name. I quickly skimmed the C++ standard and didn't see it mentioned by name. ...

ANSI C: Creating an Array of Jobs

So, we have this homework assignment that builds off of last weeks. We are supposed to create separate arrays that hold pointers to all the people of a certain job type. Here is the code I have so far. I was wondering if any one can help me out. Thanks! #include <stdio.h> #include <stdlib.h> #include "Person.h" #include "data.h" #define...

http / javascript / php post execution in C

I'm trying to figure out a way to call an html form from C, inject a bit of javascript, then submit the file and check the new URL (header from php) to make sure the form submitted correctly. Got any ideas??? ...