Consider this program:
#include <stdio.h>
int main() {
printf("%s\n", __FILE__);
return 0;
}
Depending on the name of the file, this program works - or not. The issue I'm facing is that I'd like to print the name of the current file in an encoding-safe way. However, in case the file has funny characters which cannot be represe...
I am trying to find a program in C code that will allow me to compute a eigenvalue (spectral) decomposition for a square matrix. I am specifically trying to find code where the highest eigenvalue (and therefore its associated eigenvalue) are located int the first column.
The reason I need the output to be in this order is because I am t...
Hello,
In my gtk+ application i need to split image with high resolution. How can i make it with cairo? Where can i find example?
Thank you
...
Hi All,
I'm writing a drawing program. I'm trying to take an ordered list mouse positions, and approximate a smooth Quadratic BSpline Curve. Does anyone know how to accomplish this?
Thanks!
...
Is it possible to restore the normal execution flow of a C program, after the Segmentation Fault error?
struct A {
int x;
};
A* a = 0;
a->x = 123; // this is where segmentation violation occurs
// after handling the error I want to get back here:
printf("normal execution");
// the rest of my source code....
I want a mechanism s...
I read many articles about unsafe functions like strcpy, memcpy, etc. which may lead to security problems when processing external data, like the content of a file or data coming from sockets. This may sound stupid, but I wrote a vulnerable program but I did not manage to "hack" it.
I understand the problem of buffer overflow. Take this...
Possible Duplicate:
Eigenvector (Spectral) Decomposition
I am trying to find a program in C code that will allow me to compute a eigenvalue (spectral) decomposition for a square matrix. I am specifically trying to find code where the highest eigenvalue (and therefore its associated eigenvalue) are located int the first column....
I have an array named record[10] whose type is a table structure, say { int, int, long, long,char}
I have a function to which I want to pass the address of this array which gets called in a loop:
for(i = 0 ; i<10; i++)
{
// internal resolution will be *(record + i) will fetch an address
function(record[i]);
}
I'm confused as ...
I understand that the default max buffer size I can use with these functions is 65507 (5535 - IPv4 header - UDP header). However, is there a way to change this? I need to be able send a larger buffer ~66000 bytes. I tried using the setsockopt() function, but it didn't seem to work.
Thanks!
...
I want to extract a substring from my expression using regex.h library in C. Here is the code
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
regex_t preg;
char *string = "Random_ddName:cateof:Name_Random";
char *pattern = ".*Name:\\(.*\\):Name.*";
int rc;
size_t ...
Just installed VS2010 on Windows 7 and am having an issue with include directories while attempting to compile existing C code. VS2010 appears to search the project directory first for include files regardless whether the <file.h> or "file.h" include format is used. Is there a way to force a different ordering for system include files ...
I've browsed through many JIT libraries. But I'd like to learn how to write one.
Softwire looked like nice. Though what the emitter interface should do? Can I do something better than existing libraries? How do I support inline caching?
...
Is there any good Document Parsing Lib , in C or Python?
I am trying to Parse Strings from Documents - PDF, Word Doc/Docx , Excel xls/x , PPT, ODF, and also Mac Formats.
Please Recommand Solutions that would also work in Linux/Unix enviorment.
...
I am using GNU ld's "-wrap" option to intercept calls in applications, but have ran into a scenario where the code implementing the wrapper indirectly calls the wrapped function, creating a circular reference.
Example
The goal is to wrap read calls that occur in Program Foo. This code can be recompiled/relinked, but not modified.
Prog...
So I'm writing tests for my code, and I want to stub out the calls to library functions (make sure that it's calling the right library calls at the right time, and that it handles errors appropriately).
I think I'm SOL with the C standard library functions, but those aren't the only libraries I'm using.
When building my final executabl...
I've recently started learning Win32 API and I hate Hungarian notation (those stupid prefixes in variable names which make the code looking ugly and almost unreadable), however as you may know it is absolutely everywhere in there! And this fact causes everyone to use it in their code too to keep kind of consistency... I suppose it is stu...
I'm compiling a branch of the Blender 3D modeling program from source (using SCONS), on a Fedora 8 box, and am running into an error that I didn't encounter compiling the same source on a CentOS 5 box, and I'm thinking it has to do with the variable definition. The error is:
source/blender/blenkernel/intern/implicit.c: In function ‘mul_...
Using deflate() I was unable to open the zipped file using WinZip. Are the gz() the only ones compatable with WinZip? or is there some sort of mode I must call deflate() with?
Thanks.
...
I'm trying to write a tool that will take as input some C code containing structs. It will compile the code, then find and output the size and offset of any padding the compiler decides to add to structs within it. This is pretty straightforward to do by hand for a known struct using offsetof, sizeof, and some addition, but I can't figur...
The standard specifies that the contents of reallocated space is undefined if the new size if larger.
If preserving the contents of the previously-allocated space is important, is the best way to reallocate data as follows: copying it to the stack, freeing it from the heap, allocating on the heap with more space, and copying back to the...