I have a dll and an exe, both of which I have the sources to.
For the DLL I have compiled completely statically and therefore, I would assume that the the .lib is also static. However, when I include that lib in my C++ VC++ 2008 project under Linker > Input > Additional Dependencies . I set the compile mode to /MT (multi-threaded) for t...
I want a function that returns -1 for negative numbers and +1 for positive numbers.
http://en.wikipedia.org/wiki/Sign%5Ffunction
It's easy enough to write my own, but it seems like something that ought to be in a standard library somewhere.
Edit: Specifically, I was looking for a function working on floats.
...
I have a C project in Eclipse that stores its files in two directories at the same level along with a bunch of other stuff that I do not need to have in the project.
/path/
/code_I_want
/bad_stuff/
/more_code_i_want/
/huge_pile_of_other_code/
Edit: The source directory is a Clearcase VOB mount point so I can't co...
I'm currently working on a project which requires me to split a TIFF image into a file containing all tags and a file containing all image data and to reconstruct a TIFF image from these files. The only problem is that it seems that LibTIFF provides no easy way to grab all tags from an image. I've tried using TIFFGetTagListCount and th...
This question was recently asked to me in an interview for which i went confused!!
"How do you initialize a structure in the heap memory ?"
could anybody please tell me the correct answer for this?
btw:how exactly are stack and heap memory are different from each other?
And looking about the above question some might also ask me about ...
Hi,
I have encountered a working (with XLC8 and MSFT9 compilers) piece of code, containing a c++ file with a function defined with c linkage and a reference argument. This bugs me, as references are c++ only. The function in question is called from c code, where it is declared as taking a pointer argument to the same type in place of th...
I am needing to write some code that I can compile and run on Windows, OS/X, and iPhone. The iphone is fairly limited in what you can include. Are there any simple libraries or websites that provide source code for basic things that could be compiled and use on the iPhone as well as everything else?
...
I am using getenv("HOME") in C to get the user's home directory in order to read/write a settings file. But is it possible that the home directory filename could contain characters that cannot be represented as an 8 bit char? (for example, unicode or UTF-8 encoded)
Does this differ for various varieties of Linux and *BSD?
Thanks in adv...
I need to figure out which part of a linux program that I am running, is taking how much (either percentage, or absolute) memory. I need to create a profile of multiple such programs, so that I can identify some of the bigger consumers of memory in my code, and see if I can optimize them to use less.
I need it on MIPS platform, and unfor...
I'm wondering, can you make a pointer to a group of variables in an array?
like this
array[20]{'a','b','c',...}
pointer = array[6 through 10];
so then you could say...
*pointer[0] == array[6];
and
*pointer[5] == array[10];
and the length of *pointer
5 == sizeof(*pointer) \ sizeof(type);
OK
Let me explain what I'm trying to ...
I'm writing a plain C project. I'm using a Mac and I like working with Xcode and I want to use the Xcode project and build environment. I'd like to be able to build it on other platforms though. Not being overly familiar with Linux (yet) I assume this would involve a makefile. My project has no dependencies and it's about as vanilla as i...
Suppose I want my Lex and Yacc program to parse the command line arguments like:
./a.out show memory
I want lex to parse the string "show memory". How do I accomplish this?
...
Why are there no short int literals in 'C'?
...
Hi,
I'm trying to get the page faults when I run a program with two different parts.
What I do is some operations using two matrix multiplication methods and try to figure out wich one causes more page faults.
/Operations for method 1
getrusage (RUSAGE_SELF, &usage);
fault1=usage.ru_minflt;
/operations for Method 2
getrusage (RUSA...
Hello,
I'm trying to compare different methods for matrix multiplication.
The first one is normal method:
do
{
for (j = 0; j < i; j++)
{
for (k = 0; k < i; k++)
{
suma = 0;
for (l = 0; l < i; l...
I have found that the same mod operation produces different results depending on what language is being used.
In Python:
-1 % 10
produces 9
In C it produces -1 !
1) Which one is the right modulo?
2) How to make mod operation in C to be the same like in Python?
Thank you in advance!
...
i want to parse a string which i give in the main function iin yacc . i know tat this could be done by using yy_scan_string but i don't know how to use it. i even searched net and man pages but it is not clearly given so pls help me
...
In K&R2 they implement memory allocator in chapter 8. For each block there is header defined something like this (from memory, code may be non-exact):
union header_t
{
struct
{
unsigned size;
unsigned* next;
};
long align;
};
They do this to "make sure that the header is properly aligned on the boundaries of long"...
I want to automate moving duplicate or similar C code into functions.
This must work under Linux.
...
int check_row;
for (n=0; n<9; n++) {
used_numbers[n] = n+1;
}
for (row=0; row<3; row++) {
for (check_row=0; check_row<3; check_row++) {
used_numbers[(sudoku[row][check_row]-1)] = 0;
}
...
int sudoku[9][9] declared as global variable and used_numbers[9] as int.
In sudoku matrix for row from 0 to 2 and col from 0 to ...