I'm trying to implement a basic object-oriented ANSI C runtime and using Objective-C as a guide.
They're seems to be three parts. A Class Description, Class Interface, and Class Implementation. In order for the Class Interface to be instantiated, the familiar method of using the Class object to instantiate one's object can only happen i...
Hello,
which is the best way to write a bidimensional hashmap efficiently in Java? Just to give an example of what I'm talking about: I'm developing some algorithms related to collective intelligence, these algorithms works by calculating correlation between pairs of elements..
Without caching these values, since they are calculated on...
To invoke a C API from C# I would use P/Invoke. But if I were to do the reverse, call .NET APIs from C, how would I go about it?
...
Is there a way to write a C program to convert say Dollar to Indian Rupee (or visa-versa). The conversion parameter should not be hardcoded but dynamic. More preciously it should get the latest value of Rupee vs Dollar automatically(from Internet) ?
...
In order to make a page dirty, I touch the first bytes of the page like this:
pageptr[0] = pageptr[0];
But it seems gcc will eliminate the statement when optimizing. In order to prevent gcc optimizing it, I write the statement like this:
volatile int tmp;
tmp = pageptr[0];
pageptr[0] = tmp;
It seems the trick works, I'd like to kno...
I download and tried it today.
It compiles my project but "suncc" is even slower then "gcc" which is famous for its leisureliness. I just -xO1 which i thought should do no optimizations. I have a lot of inline declared C functions. Is there a way to disable the inlining or anything else to make it compile faster.
...
I'm trying to parse an argument value in C and convert the number to a double value. I have:
char *stringEnd;
double num = strtod("123.0", &stringEnd);
I used 123.0 just to test the function, but it always returns a value of 0.0. Does anybody know what I'm doing wrong?
...
Is there an API in Windows similar to Linux's chown?
...
A simple question:
I need to add some logging to my program.
If two processes use "fwrite" on the same file but not the same file descriptor will the written log messages be atomic or mixed. Is there a length limit?
Is it defined ANSI-C behaviour or implementation defined?
If the later what is on MacOSX, Linux and Windows MSVC?
...
Which is more efficient
if(!var_name)
or
if(var_name == NULL)
...
This question is directed at any fans of Numerical Recipes or anyone that understands FFT well.
Can anyone explain why the real component is calculated by -2*(sin(theta/2))^2 ?
I can't seem to wrap my head around it. I've seen other examples such as http://www.dspdimension.com/admin/dft-a-pied/ tutorial which simply takes cos(theta) as ...
I'm learning the C language on my Mac with Xcode.
I've created a "Hello World" app, and played around with simple maths.
What should be my next goal? If someone was to ask me about PHP for example, I'd say "build a basic blog software". Can someone point me in what would be a great learning experience for someone new to C? One that wil...
I have a data file which contains data in row/colum form. I would like a way to read this data in to a 2D array in C or C++ (whichever is easier) but I don't know how many rows or columns the file might have before I start reading it in.
At the top of the file is a commented line giving a series of numbers relating to what each column h...
While i am working ,somewhere inside the code i saw the following staements.
I am getting confused by the format specifier in sprintf
d_number = strtol( tmp_buf , (char **)NULL, 16);
memset( tmp_buf , ' ' , sizeof( tmp_buf ) );
sprintf( tmp_buf , "%0.*d" , (int)sizeof( dec_number ) , d_number );
could anybody explain please?...
Just wondering why this is the case. I'm eager to know more about low level languages, and I'm only into the basics of C and this is already confusing me.
Do languages like PHP automatically null terminate strings as they are being interpreted and / or parsed?
I've also read a string in C is really an array of chars in an article I fou...
Hi Im on mac snow leopard and test these code on xcode3.2 of the Learning OpenCV
everything works fine but the image doesnt appear and in the windows. I had try to understand searching for two days what does argv[1] means, but Im still no clear. Im a newbie en C++. I had the image in the same directory where the main.cpp is
#include <Op...
This is a question I've come across repeatedly, usually concerning plug ins, but recently I came across it trying to hammer out some build system issues. My concern is primarily for *nix based systems, but I suppose it applies to windows as well.
The question is, what is the minimum amount of information necessary to do dynamic linking?...
How to convert __int64 to long in Windows (MSVC8 & MSVC6)?
Will a normal typecasting work?
Also, how about converting long to __int64? If the long is a negative value, will it work?
Note - I am talking of a scenario in which the __int64 variable will always contain a value which will not be more than 32 bits long.
...
As the title.
I have a program must be compiled only in DEBUG mode. (testing purpose)
So I want to prevent compilation in RELEASE mode by this way.
...
I am writing a Java implementation of an app originally written in C. I can't modify the C version, and the Java version must share encrypted data with the C version.
Here's the relevant part of the C encryption code:
makekeys(password,&key1,&key2); /* turns password into two 8 byte arrays */
fill_iv(iv); /* bytes 8 bytes of randomness...