Hello all,
I have a java application which uses JNI in some parts to do some work. It follows the usual loading of DLL and then calling native methods of DLL. Is there any way we can restrict what native methods can do from the java application? For example, can we restrict DLLs not to open any files or not to open any sockets even if i...
Possible Duplicate:
Passing pointer argument by reference under C?
Are reference variables a C++ concept? Are they available in C? If available in C, why is my code giving a compilation error?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 10;
int b = 20;
int &c = a;
int &d = b;
return 0;
}
Output:
ba...
I am writing an arduino library to post http request on web.
I am using the String class from http://arduino.cc/en/Tutorial/TextString
My code is behaving strangely when I am referring to my defined string objects after a function call.
Here actually I am trying to get the body of my GET request and removing the http headers from the ...
I am wondering if you can : lock only a line or a single character in a file in linux and the rest of the file should remain accessible for other processes?
I received a task regarding simulating transaction on a file with c/c++ under linux .
Please give me an answer and if this answer is yes ,give me some links from where i could take a...
Can someone explain how does less than op work in C?
In particular how it works when types of left hand side and right hand side operands are different?
Does it compare them based on type of the first one or the second one?
...
Hi there,
Well im creating an iPhone application which contains some features like Cycle routes and a Photoviewer.
For these Cycle routes im useing the Cloudmade api, and for the PhotoViewer im useing Three20's TTPhotoviewcontroller.
These Cycle routes map works perfect but i think it has todo something with the errors im getting.
I ...
I am trying to understand what the following line of the worst-ever-seen C code (from uboot project) mean:
rc = ((ulong (*)(bd_t *, int, char *[]))addr) (bd, --argc, &argv[1]);
What is it? A function call?
Can it be more readable?
Thanks in advance for your help!
...
Hello,
I have a simple C DLL (not COM). I have also a C# 2.0 application that runs it (dllimport). The dll is placed in the exe of the application. I know that the dll is ok and also that my application that calls it success reading it, but when I move them to another computer it says that it can load the dll.
The error : "Unable to l...
I have a function which is called explicitly by 4 other functions in my code base. Then in turn each of these functions is called by at least 10 other functions throughout my code. I know that I could, by hand, trace one of these function calls to the main function of my program (which has 30 function calls) but it seems like this woul...
I am working on a program that sorts its input lines alphabetically/numericaly depending on the arguments passed to main. And this is the follow-up exercise:
Add a field-handling capability, so sorting may be done on fields within lines, each field sorted according to an independent set of options. (The index for this book was sorted wi...
I am trying to add a new IP address to a local network adapter in Windows using the Windows API. Are there functions to do this in the Windows API, and if so, what are they?
I am not trying to create virtual network adapters, but simply trying to assign multiple IP addresses to the same adapter.
...
Hello,
How can I lock a file for a specified period of time (10 seconds) using the C language in Ubuntu Linux ?
...
How to find the size of a predefined char[] variable that holds a string?
Should sizeof be enough?
I don't want to use strlen() since a '\0' character may occur in the string, and for optimization reasons.
E.g.: char str[] = "Hello \x45\x10\x00 World!";
What do you do when there're initials in the identifier? E.g. GetURLParameters().
I ...
I saw this question on SO about casting, and the answer specifically mentioned numeric types. I thought I understood this till now, when I have to do it.
I have two int's I want to add, divide by two and save to another int. So I create a temporary variable called 'bucket' that's one datatype bigger, add the two ints and shift right b...
I'm considering integrating some C code into a Python system (Django), and I was considering using the Python / C API. The alternative is two separate processes with IPC, but I'm looking into direct interaction first. I'm new to Python so I'm trying to get a feel for the right direction to take.
Is it possible for a call to a C initiali...
I would like to do something like the below for a multi-threaded program:
// wait for variable to become true but don't hog resources
// then re-sync queues
Is something like this a good solution?
while (!ready) {
Thread.Sleep(250); // pause for 1/4 second;
};
...
I have a problem compiling the following code:
#include <stdio.h>
#include <limits.h>
int main () {
printf("short: [%d,%d]\n",SHRT_MIN,SHRT_MAX);
printf("int: [%d, %d]\n",INT_MIN, INT_MAX);
printf("long: [%d, %d]\n",LONG_MIN,LONG_MAX);
int aa=017;
printf("%d\n",aa);
return 0;
}
Error message is:
1>c:\tic\ex1\e...
int ara(int dizi[], int ilk, int son, int deger) {
int indeks;
if ( ilk > son )
return 0;
indeks = (ilk + son) / 2;
if ( dizi[indeks] < deger )
return ara(dizi, indeks+1, son, deger);
else if ( dizi[indeks] > deger )
return ara(dizi, ilk, indeks-1, deger);
else
...
I have looked around but have been unable to find a solution to what must be a well asked question.
Here is the code I have:
#include <stdlib.h>
struct my_struct {
int n;
char s[]
};
int main()
{
struct my_struct ms;
ms.s = malloc(sizeof(char*)*50);
}
and here is the error gcc gives me:
error: invalid use of flexibl...
There are two unsigned ints (x and y) that need to be subtracted. x is always larger than y. However, both x and y can wrap around; for example, if they were both bytes, after 0xff comes 0x00. The problem case is if x wraps around, while y does not. Now x appears to be smaller than y. Luckily, x will not wrap around twice (only once is...