I'm trying to use FFTW to compute fast summations, and I've run into an issue:
int numFreq3 = numFreq*numFreq*numFreq;
FFTW_complex* dummy_sq_fft = (FFTW_complex*)FFTW_malloc( sizeof(FFTW_complex)*numFreq3 );
FFTW_complex* dummy_sq = (FFTW_complex*)FFTW_malloc( sizeof(FFTW_complex)*numFreq3 );
FFTW_complex* orig = (FFTW_complex*)FF...
Hi,
I need to convert a bunch of bytes in ISO-2022-JP and ISO-2022-JP-2 (and other variations of ISO-2022) into Unicode. I am trying to use ICU (link text), but the following code doesn't work.
std::string input = "\x1B\x28\x4A" "ABC\xA6\xA7"; //the first 3 chars are escape sequence to use JIS_X201 character set in GL/GR
UErrorCode...
I want to write a program to load a key-value store with lots of random data of random types. Assuming the key-value store supports three types ( strings, lists and sets ) there are operations that are valid for a set (say, union) that are not valid for strings.
#define SUBSTR 0 // substring, only on strings
#define SEARCH 1 // search...
I have a function uint8_t EE_Write(uint8_t addr, uint8_t len, uint8_t * buf) that takes a pointer to some data that it will write to memory, and a uint16_t myword that I want to give it. The basic
EE_Write(0,sizeof(myword),&myword);
gives me the compiler warning "Indirection to different types ('unsigned int *const ' instead of 'unsi...
Hey guys. simple question: how to remove accents from a char? Like ã -> a, and é -> e. I asked in another question how to convert utf-8 to ascii but this is unnecessary, since I only need to treat those situations.
I tried:
char comando;
if( comando == 'ç' || comando == 'Ç') {
comando = 'c';
return comando;
}
But ...
Hi I'm currently learning Python since the syntax feels so succinct and the idioms match well with my mental model.
However I'm also interested in learning about OS internals and reverse engineering software, which ultimately means knowing C in a rather thorough capacity.
When originally picking a language I did lots of reading and com...
I'm working on an existing c project (spglib on sourceforge), and I'm running into the following problem after cleaning up some array initializations:
* glibc detected tests/spglibtest: free(): invalid next size (fast): 0x08ab46e0 **
The backtrace is:
#0 0xb7fe1424 in __kernel_vsyscall ()
#1 0xb5cfdd61 in raise () from /lib/libc.so...
Possible Duplicate:
Tips for Junior Programmers
What is the best advice you can give a novice/inexperinced programmer, witch would help him the most in the long run of his carrier?
The best advice i've ever recieved was "Make it work, before seriously optimizing it". (Later I found out that he's was inspired by the famours li...
Possible Duplicate:
Why does this Seg Fault?
Hello, I have a
char* str = "blah";
And I now want to change one of the characters to something else, say a number 3. I am trying to do so with:
str[2] = '3';
However I am getting a seg fault at this line of code. Any idea why?
...
Using C, how do we find the max size of char* allowed by a file system?
...
I'm looking for an easy to use lib that will convert an MP3 file to a sequence of int values (and the reverse), preferable without having to dump them all into RAM. A "decode the next 16kB into this buffer" like API would be ideal.
I need C or simple C++ bindings.
A MP3<->RAW filter CLI tool would work but I'd rather not have to keep u...
If I input 5 5 at the terminal, press enter, and press enter again, I want to exit out of the loop.
int readCoefficents(double complex *c){
int i = 0;
double real;
double img;
while(scanf("%f %f", &real, &img) == 2)
c[i++] = real + img * I;
c[i++] = 1 + 0*I; // most significant coefficient is assumed to be ...
how would you parse the string, 1234567 into individual numbers?
...
Is there a C data structure equatable to the following python structure?
data = {'X': 1, 'Y': 2}
Basically I want a structure where I can give it an pre-defined string and have it come out with an integer.
...
I discovered this while using ruby printf, but it also applies to C's printf.
If you include ANSI colour escape codes in an output string, it messes up the alignment.
Ruby:
ruby-1.9.2-head > printf "%20s\n%20s\n", "\033[32mGreen\033[0m", "Green"
Green # 6 spaces to the left of this one
Green # correctly ...
I have some code that does the following:
while(some condition)
{
char *line[WORDLEN];
//do stuff to line, including strcat(line, "words")
printf("%s", line);
line[0] = '\0';
}
However, it seems like line[0] = '\0' is not doing what I am hoping it will do. I want to go back through the loop, and use line as though ...
What is the C equivalent to the C++ cin statement? Also may I see the syntax on it?
...
Something like this, I'd like to see the full syntax.
Pseudo Code:
var = user_input
if var > 5:
output = 'var > 5'
else:
output = 'var < 5'
...
When I run the following snippet it runs until the second question. It then puts the "Is the customer a student? (y/n) \n" and "What is the movies time? (in hours) \n" prompts together (no area to answer between them). If one takes any action from there on, the program stops working. What did I do wrong? (i'm pretty sure it's syntax rela...
Convert from color HEX code to RGB in pure c using C library only (without C++,templates, etc.) RGB struct may be like this -> typedef struct RGB{ double r; double g; double b; } RGB1;
function should return RGB1
...