Recently, I want to optimize my code. Would any one tell how to speed up looping? While-loop is faster than for-loop? And which type of for-loop is faster?
It is surely I am not talking about a empty content looping. I mean If any good way to loop a huge data in Java or Python.
And I got the answer from here
...
Hi,
Basically in the code below, my final array does not seem to have the contents from function1(). Any ideas on why I can't get this to work ? Thanks.
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
unsigned char *function1()
{
unsigned char array2[] = { 0x4a,0xb2 };
return (array2 );
}
main()
...
I'm taking an operating systems design class in which they have given us a microkernel written in C that we're building on top of. The kernel seems to have been designed with 32-bit machines in mind and I'm running snow leopard. So a friend in the class and I have been trying to hack it into 64-bit addressing.
The biggest issue seems to...
I managed to compile Lua 5.1.4 for Palm webOS and now I'm trying to write an extension to use webOS' services from Lua. However, when I try to load my library, Lua reports:
undefined symbol: lua_pushlstring
Here's my code:
#define LUA_LIB
#include "lua.h"
#include "lauxlib.h"
static int hellopalm(lua_State *L) {
lua_pushliteral(...
Hi,
I am using C language and Linux as my programming platform in embedded device.
My question is, how to correctly retrieve the current processor time(tick). I am using clock() function in time.h and it seems I am getting inconsistent value.
Thanks.
...
i have an application with 4 threads from which 2 are event based and 2 are not event based.
the problem is i have to isolate the 2 non event based threads in which while(1) loop is executing that takes a huge cpu usage and this usage reaches even up to 100%,
i think making these threads isolated can reduce the cpu usage,
will it be a...
As documented:
"If not all tabs can be shown at once, the tab control displays an up-down control so that the user can scroll additional tabs into view."
http://msdn.microsoft.com/en-us/library/bb760550%28VS.85%29.aspx
I don't want this. I don't want an up down control to show if I have too many and I don't want multiline tabs. I...
My definition of powerful is ability to customize.
I'm familiar with gcc I wanted to try MSVC. So, I was searching for gcc equivalent options in msvc. I'm unable to find many of them.
controlling kind of output
Stop after the preprocessing stage; do not run the compiler proper.
gcc: -E
msvc: ???
Stop after the stage of compilation pr...
In C, what will happen if I supply a signed integer especifically a negative integer as the 3rd argument to the memcpy function?
Example:
memcpy(destBuf, source, -100*sizeof(source))
Will the result of -100*sizeof(source) be interpreted by memcpy as unsigned?
Thanks!
...
Greetings all,
Please take a look at following code:
#include <stdio.h>
#include <iostream>
using namespace std;
typedef struct MyType{
int num1;
};
void test(MyType **src)
{
MyType *ret=new MyType;
ret->num1=666;
*src=ret;
}
int main(){
MyType *mSrc;
test(&mSrc);
printf("%d Address\n",mSrc);
printf("%d Value \n",mSrc->num1)...
Hi Friends,
I need a c,c++ code for validating a Phone Number(8 Digits- Starting with 2) and Mobile Number(10 Digits- Starts with 9).
Also it should not allow to enter any space, special charcter, as well as charcters.
Here user can enter either phone number or mobile number.
Plese Help in this,
Thanks,
...
I have UTC time which is coming from UDP, I have a program to calculate Day and Time of UTC, how can I set my system clock at that day and time, kindly give me some direction so that I can make it possible.
I am using window OS.
...
In a project of mine (which for technical reasons must not depend on any external libraries or third-party sources) I have set up the following test.h:
static int rc = 0;
#define TESTCASE( x ) if ( x ) {} \
else \
{ \
rc += 1; \
printf( "FAIL...
Possible Duplicate:
Using a C++ class member function as a C callback function
I'm writing an object-oriented library using a C library (winpcap). I need to pass the callback function that is called when a network packet arrives as a function pointer. I would like to pass a member function pointer to winpcap, to keep my design...
We have an application that uses two types of socket, a listening UDP socket and an active SCTP socket.
At certain time we have scripts running on the same machine that have high IO activities (such as "dd, tar, ..."), most of the time when these IO heavy applications run we seem to have the following problems:
The UDP socket closes
T...
I am currently developing a programming language in C, and I want to allow users to create apparently "unlimited" arrays with numerical indices without sacrificing performance in the process. For example, table [1000000000] would ideally be creatable and accessible in an instant without the memory overhead of a table of 1,000,000,000 ite...
How do I transfer files from one folder to another, where both folders are present in oracle home directory?
int main(int argc, char *argv[]){
char *home, *tmp2;
home = getenv("ORACLE_HOME");
temp2 = getenv("ORACLE_HOME");
strcat (home,"A");
strcat (tmp2,"B");
//transfer files from home to tmp2
}
strcat doesn't ...
I'm looking for a library to manage menus. I'm looking for something which is based on configuration files. It doesn't have to manage keyboard input or display, just the menu logic. What I have in mind something like:
//menu.xml
<menu>
<Start />
<Stop />
<Configuration displayname="Configure System">
<Sound type="tog...
If int var=20 then how
printf("%d %d %d", var--, ++var, --var);
execution happens in C programming language.
...
I have a Visual C console application (created in VC++2008EE) and I need to add GUI to it.
One idea was to invoke the console app as a subprocess and communicate with it using stdin and stdout. I tried to do that with Python subprocess module - but it deadlocks (probably because my console app is running continuously). As I understood f...