I'm using libavcodec (latest git as of 3/3/10) to encode raw pcm to aac
(libfaac support enabled). I do this by calling avcodec_encode_audio
repeatedly with codec_context->frame_size samples each time. The first four
calls return successfully, but the fifth call never returns. When I use gdb
to break, the stack is corrupt.
If I use a...
We have a bunch of C/C++ modules and projects for QNX4, QNX6 and Linux. All of these are written in Eclipse/QNX Momentics and we use Project Sets (psf files) to combine different modules into projects as required. The projects are built using make. The psf files specify which modules are required for a certain project.
I have looked at ...
I create a 2D array in C as follows:
int **arr;
arr = malloc(rows * sizeof(int *));
for (i = 0; i < rows; i++)
arr[i] = malloc(cols * sizeof(int));
Now, I call:
func(arr)
In the function func, how do I calculate the row and column dimensions?
...
I am working with a C89 compiler and I'm coming across some pointer typing error.
Calling code:
struct cpu_state_type cpu_state;
//Stuff here....
foo()
{
print_out_cpu(&cpu_state);
}
Print_out_cpu is defined elsewhere and the H file is #included in.
struct cpu_state_type
{
int r[12];
};
void print_out_cpu(struct cpu_state_type...
Sometimes I have to write code that alternates between doing things and checking for error conditions (e.g., call a library function, check its return value, keep going). This often leads to long runs where the actual work is happening in the conditions of if statements, like
if(! (data = (big_struct *) malloc(sizeof(*data)))){
//re...
Possible Duplicate:
What is the best source to learn C++?
I have been coding in C for quite some time now (around 3 years). Now i wish to learn programming in C++ and code in object oriented methodology.
There has been some discussion on how to start learning C++ http://stackoverflow.com/questions/525726/the-best-place-to-st...
Hi
I would like to create a chat application(desktop-app) in c++, so which protocol i would need to study and implement. UDP(?)
Please provide me some good thoughts and advices and links also.
...
For some reason I keep getting segmentation fault when I try to get the size of my struct.
struct my_struct {
char *a;
int b;
};
int main(int argc, char *argv[])
{
struct my_struct dastruct;
size_t len = sizeof(dastruct) / sizeof(struct my_struct); // error
qsort(dastruct, len, sizeof(struct my_struct), cmp);
...
}...
If the float contains "5.12345", display only "5.1"
If the float contains "5.0", display only 5 (drop the ".0")
If the float contains "5.0176", display only 5 (drop the ".01")
I thought printf() could do something like this... but now I can't seem to get it to work.
...
Hi!
I want to create an application, where i can set, what prefix or suffix i want to send to the Barcode reader. The barcode reader may connect to the PC with USB or RS-232 ports. I mean if i have a barcode like "4567", and i set in my application that it should send a prefix like "123" to the barcode scanner, than if i read my barcode...
In C, I want to loop through an array in this order
for(int z = 0; z < NZ; z++)
for(int x = 0; x < NX; x++)
for(int y = 0; y < NY; y++)
3Darray[x][y][z] = 100;
How do I create this array in such a way that 3Darray[0][1][0] comes right before 3Darray[0][2][0] in memory?
I can get an initialization to work that g...
Hi there.
I am performing an LDAP search query in C like so;
ldap_search_ext_s(ld, BASEDN, SCOPE, FILTER, attrs, 0, NULL, NULL, NULL, LDAP_NO_LIMIT, &res);
My search performs fine except when I try to specify FILTER to be;
#define FILTER "uid=*", that is, when I try to run a search for all LDAP entries with a uid.
Unfortunately my ...
Is there any debugger, like gdb or something else, aimed for C/C++, that runs on top of LLVM?
Given how well engineered LLVM is, this almost seems like a perfect opportunity.
...
I've followed this question and it works well, but it takes away focus from my sending control.
What I'm trying to do is to create an entry box that works like an auto complete text box - a text box and a popup control that contains the list of matching items. I need to be able to take keys, such as Up,Down and route them to the popup...
I'd like to get the C source lines inline with the assembly output to see what code is being generated.
I have tried GCC options like -S -Wa,-ahlms (and even -Wa,--gstabs 'cause I read it somewhere).
Oh! BTW, I am on a Mac so I don't have objdump.
(Sorry this is short, I have to get off the train!)
Output of gcc pc-clisp.c -S -g -fve...
Update: After some more reading I see that this problem is totally general, you can't mix architectures in the same process, so 64 bit Java cannot dlopen() a 32 bit library like FMOD. Is there any possible workaround for this, keeping in mind I'm writing my own C interface to the FMOD library?
I need to make a 64-bit dylib on Max OS X b...
Hi there, this is for a small project of mine, I'm trying to set the current process working directory to the One directory up as
if my current directory is ..\downloads\movies
i'd like code to set the directory to ..\downloads
I know this is possible by getting the current working directory path and extracting the directory path i need...
Hi,
I am getting this compiler (gcc 4.5) warning:
`
> Formatter.cpp:23: warning: unknown
> conversion type character ‘"’ in format
And this is my code at line 23:
dprintf (fd, "<svg width=\"100%\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">");
I can't spot what am I doing which causes the warning. Can...
this is part of my code which reads an http response. It's supposed to increase the buffer size if it runs out of room. But i keep getting access violations. It happens when copying the data to the new buffer: memcpy(tmp_alloc, rec, ResponseLength); Any help/suggestions are appreciated.
#define SERVER_CHUNK 1024
char *rec = new char[10...
Using OpenCV, saving a CvMat structure into a YAML file on the disk is easy with
CvMat* my_matrix = cvCreateMat( row_no, col_no, CV_32FC1 );
cvSave("filename.yml", my_matrix);
However, I couldn't find an easy way to read the saved files back from the disk. Is there function in OpenCV that can handle this and create a CvMat structure...