In general, what needs to be done to convert a 16 bit Windows program to Win32? I'm sure I'm not the only person to inherit a codebase and be stunned to find 16-bit code lurking in the corners.
The code in question is C.
...
From what I've seen in the past, StackOverflow seems to like programming challenges, such as the fast char to string exercise problem which got dozens of responses. This is an optimization challenge: take a very simple function and see if you can come up with a smarter way of doing it.
I've had a function that I've wanted to further op...
What tools do you use to check your C code ?
That is, a tool that helps you determine if you don't have unwanted infinite loop, if you silently cast enum to int, etc. (like a C lint)
Please, precise if it is opensource and on which OS is runs.
Edit : telll also which C standard it supports
...
I'm trying to figure out what the compiler doesn't like about this:
enum { COLS = 10 };
void process_row( int arr2d[][COLS], int row, int arr[], int pickrow);
...
int a2d[][COLS] = { {1,2,3}, {4,5,6}, {7,8,9} };
I get a error: ISO C90 forbids mixed declarations and code on the a2d[][COLS] declaration. I tried looking up the error but...
Are there any good configuration file reading libraries for C\C++ that can be used for applications written on the linux platform. I would like to have a simple configuration file for my application. At best i would like to steer clear of XML files that might potentially confuse users.
...
I have got a C function in a static library, let's call it A, with the following interface :
int A(unsigned int a, unsigned long long b, unsigned int *y, unsigned char *z);
This function will change the value of y an z (this is for sure). I use it from within a dynamic C++ library, using extern "C".
Now, here is what stune me :
y ...
In Guile 1.6.*, the function scm_istring2number(char *str,int strlen,int radix) does the work.
However, this function does not exist in Guile 1.8..
How can I accomplish the same task in Guile 1.8.?
This is not trivial because the function scm_string_to_number(SCM str,int radix) does not convert numbers larger than 2^31-1 (at least ...
Suppose I have one long long int and want to take its bits and construct four unsigned short ints out of it.
Particular order doesn't matter much here.
I generally know that I need to shift bits and truncate to the size of unsigned short int. But I think I may make some weird mistake somewhere, so I ask.
...
Okay, we know that the following two lines are equivalent -
(0 == i)
(i == 0)
Also, the first method was encouraged in the past because that would have allowed the compiler to give an error message if you accidentally used '=' instead of '=='.
My question is - in today's generation of pretty slick IDE's and intelligent compilers, d...
How do you perfom Unit-Test like tests in C? Which framework or do you do other Tests as Unit-Tests on code level?
...
We have a system written in C and running under Solaris & Linux that uses the Sybase CT-library to access a Sybase database.
We generate the table-definitions, indexes, stored procedures and C-code from an in-house developed DDL to reduce the amount of work and errors.
We would like to achieve database independence, so we can add (as a ...
What does the following code do in C/C++?
if ( blah(), 5) {
//do something
}
...
What are the essential addons to help with editing C?
...
I have a popen() function which executes "tail -f sometextfile". Aslong as there is data in the filestream obviously i can get the data through fgets(). Now, if no new data comes from tail, fgets() hangs. I tried ferror() and feof() to no avail. How can i make sure fgets() doesn't try to read data when nothing new is in the file stream? ...
Does is make sense to qualify bit fields as signed / unsigned?
...
I have a C++ program representing a TCP header as a struct:
#include "stdafx.h"
/* TCP HEADER
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port ...
In C, is it possible to forward the invocation of a variadic function? As in,
int my_printf(char *fmt, ...) {
fprintf(stderr, "Calling printf with fmt %s", fmt);
return SOMEHOW_INVOKE_LIBC_PRINTF;
}
Forwarding the invocation in the manner above obviously isn't strictly necessary in this case (since you could log invocations in oth...
Looking at learning some C since i saw in another SO question that is good to learn for the language and for the historical experience.
Wondering about what IDE's professionals use and what other tools are useful while programming in C?
...
What is the most reliable way to find out CPU architecture when compiling C or C++ code? As far as I can tell, different compilers have their own set of non-standard preprocessor definitions (_M_X86 in MSVS, __i386__, __arm__ in GCC, etc).
Is there a standard way to detect the architecture I'm building for? If not, is there a source for...
UPDATE: i updated the code and problem description to reflect my changes.
I know now that i'm trying a Socket operation on nonsocket. or that my fd_set is not valid since:
select returns -1 and
WSAGetLastError()returns 10038.
But i can't seem to figure out what it is. Platform is Windows. I have not posted the WSAStartup part.
in...