I have an IPaddress and subnet mask, both in unsigned long; how can I AND both of these and check whether my incoming ipaddress (ip2) belongs to the same subnet or not?
like:
if (ip1 & subnet == ip2 & subnet)
then same subnet.
...
I'm trying to allow users to simply hit Enter without typing anything, and use this to mean accepting a default value. scanf isn't doing what I want and the app still 'blocks': the next line of code doesn't run.
The only way is to actually type something THEN press Enter.
I tried using NSFileHandle and fileHandleWithStandardInput; how...
Talking about strings in C++, what is the difference between the following statements: s1=s2 and strcpy (s1, s2)? Supposing that s1 and s2 are (original version: type 'char', as revised) type char *.
...
The C routines opendir(), readdir() and closedir() provide a way for me to traverse a directory structure. However, each dirent structure returned by readdir() does not seem to provide a useful way for me to obtain the set of pointers to DIR that I would need to recurse into the directory subdirectories.
Of course, they give me the name...
The ANSI C grammar from -link- give me the following rules for array declarations:
(1) | direct_declarator '[' type_qualifier_list assignment_expression ']'
(2) | direct_declarator '[' type_qualifier_list ']'
(3) | direct_declarator '[' assignment_expression ']'
(4) | direct_declarator '[' STATIC type_qualifier_list assignment_expre...
Hey guys. I am reading a book and It told me to open a empty WIN32 project. create source file called main.cpp. Put it in the source folder (This is the only file i have in my project). In that file put the following code
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmd...
When I create a empty Win32 project. My intellisense stopped working. Is it possible to get it working for empty Win32 Projects with 1 source file ? Thanks
...
Just out of curiosity I wonder if it is possible to relocate a piece of code during
the execution of a program. For instance, I have a function and this function should
be replaced in memory each time after it has been executed. One idea that came up our mind
is to use self-modifying code to do that. According to some online resources, s...
I am working on an Android program which calls in to native code. That native code is segfaulting, and since getting debugging working through the android NDK is not really doable, I'm left with a callstack like the following (captured from ddms). My question is whether there is something I can manually run after the fact to translate ...
I am following a tutorial. And I am trying to draw a .bmp file to the screen. It builds with no errors but no image appears. according to the book, I should see the image pop up in random places. Below is my code. The author doesnt recommend this technique for drawing objects, he is just doing for demostration. In case your wondering.
...
I'm looking to list and store the contents of a directory in a struct using C on Windows.
I'm not necessarily looking for anyone to write out the code I'm looking for, rather point me in the right direction when it comes to which library I should be looking at.
I've been Googling for a few hours now and all I'm finding is C#, C++ solu...
Hello,
I have a javascript file, and I want to translate it in C, I did it but I have a big runtime error.
Everything work well until the end of the function when it return an int.
If you have some ideas where the bug is.
Thanks a lot.
#ifndef max
#define max( a, b ) ( ((a) > (b)) ? (a) : (b) )
#endif
char *substring(size_t start, ...
I am reading a book and it mentions certain data type as being long pointer. Just curious about what that meant. Thanks.
...
I want to write some portable (as possible) C code to look up DNS TXT records. I would also prefer not to have dependencies on libraries that don't ship with the machine.
What is the best way to do this on Unix-like machines using standard libraries?
I found some sample code that works using libresolv, but it's not reentrant (not threa...
I'm new to C89, and trying to do some socket programming:
void get(char *url) {
struct addrinfo *result;
char *hostname;
int error;
hostname = getHostname(url);
error = getaddrinfo(hostname, NULL, NULL, &result);
}
I am developing on Windows. Visual Studio complains that there is no such file if I use these incl...
I am using MSVS C++ Express 2008. Right now my intellisense only works for objects that have methods or arguments in a method. Is it possible to set it where it detects declared constants and varibles that are within scope. Thanks
...
When performing SQL statements such as UPDATE, and INSERT, the usual .fetch*() methods on the Cursor instance obviously don't apply to the number of rows modified.
In the event of executing one of the aforementioned statements, what is the correct way to obtain the corresponding row count in Python, and the corresponding API in the Sqli...
I'm trying to print the list of a singly linked list that I referred to in link text
It works, but I do get the compiler warnings
"Initialization discards qualifiers from pointer target type"(on declaration of start = head) and return discards qualifiers from pointer target type"(on return statement) in this code (I am using XCode):
/...
Suppose I have a C function:
void myFunction(..., int nObs){
int myVec[nObs] ;
...
}
Is myVec being dynamically allocated? nObs is not constant whenever myFunction is called. I ask because I am currently programming with this habit, and a friend was having errors with his program where the culprit is he didn't dynamically al...
Hi, My app now has been sealed as a product, which will be sold with a PC with linux system installed. How ever I will create a new user for the customers, but I want bind a interface-like app to the user, so when my custumers log in via terminals the selected app runs automatically, when connection ends, the app quit the same way.
I kno...