Search Results

Search found 3592 results on 144 pages for 'pointer'.

Page 26/144 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • JNA problem with char** (in dll)

    - by underline
    Hi, ok it is 'easy' to make jna wrapper solution for mapping exported functions within dll using jna: long f1(int x), just int long f2(char* y), just char[] but how to deal with long f3(char** z) ? I need f3's result(long) as well as z value on java side. Please don't say cpp code should be rewritten to avoid this:-)

    Read the article

  • Reusing a NSString variable - does it cause a memory leak?

    - by Chris S
    Coming from a .NET background I'm use to reusing string variables for storage, so is the code below likely to cause a memory leak? The code is targeting OS X on the iphone/itouch so no automatic GC. -(NSString*) stringExample { NSString *result = @"example"; result = [result stringByAppendingString:@" test"]; // where does "example" go? return result; } What confuses me is an NSStrings are immutable, but you can reuse an 'immutable' variable with no problem.

    Read the article

  • C++: Cannot convert from foo& to foo*

    - by Rosarch
    I have a method: odp(foo& bar); I'm trying to call it: foo baz; odp(&baz); I get a compiler error: error C2664: "odp" cannot convert parameter 1 from 'foo *' to 'foo &' What am I doing wrong? Aren't I passing in a reference to baz? UPDATE: Perhaps I have a misconception about the relationship between pointers and references. I thought that they were the same, except references couldn't be null. Is that incorrect?

    Read the article

  • C++: ptr->hello(); /* VERSUS */ (*ptr).hello();

    - by Joey
    i was learning about c++ pointers... so the "-" operator seemed strange to me... instead of ptr-hello(); one could write (*ptr).hello(); because it also seems to work, so i thought the former is just a more convenient way is that the case or is there any difference?

    Read the article

  • Basic help needed with pointers

    - by sbsp
    Hi, i asked some time ago on an account i cant remember how to manipulate basic pointers and someone gave me a really good demo for example char *ptr = hello (hello = a char array) so now *ptr is pointing at h ptr++ = moves the ptr to point at the next element, to get its value i do *ptr and that gives me e ok so far i hope :D but now i need to manipulate a char **ptr and was wondering how i do this in a way that mimmicks the effects of a 2d array? some basic tips would be much appreciated as i need to do an assignment that has a **ptr to immitate a 2d array and without knowing how it does this first means i cant even solve it on paper (for example, how do you dereference a **ptr, how do you get [x][y] values etc) thanks

    Read the article

  • Building 16 bit os - character array not working

    - by brainbarshan
    Hi. I am building a 16 bit operating system. But character array does not seem to work. Here is my example kernel code: asm(".code16gcc\n"); void putchar(char); int main() { char *str = "hello"; putchar('A'); if(str[0]== 'h') putchar('h'); return 0; } void putchar(char val) { asm("movb %0, %%al\n" "movb $0x0E, %%ah\n" "int $0x10\n" : :"m"(val) ) ; } It prints: A that means putchar function is working properly but if(str[0]== 'h') putchar('h'); is not working. I am compiling it by: gcc -fno-toplevel-reorder -nostdinc -fno-builtin -I./include -c -o ./bin/kernel.o ./source/kernel.c ld -Ttext=0x9000 -o ./bin/kernel.bin ./bin/kernel.o -e 0x0 What should I do?

    Read the article

  • Cant free memory.

    - by atch
    In code: int a[3][4] = {1,2,3,4, 5,6,7,8, 9,10,11,12}; template<class T, int row, int col> void invert(T a[row][col]) { T* columns = new T[col]; T* const free_me = columns; for (int i = 0; i < col; ++i) { for (int j = 0; j < row; ++j) { *columns = a[j][i]; ++columns;//SOMETIMES VALUE IS 0 } } delete[] free_me;//I'M GETTING ERROR OF HEAP ABUSE IN THIS LINE } int main(int argc, char* argv[]) { invert<int,3,4>(a); } I've observed that while iterating, value of variable columns equals zero and I think thats the problem. Thanks for your help.

    Read the article

  • How to check if the internal typedef struct of a typedef struct is NULL ?

    - by watchloop
    typedef struct { uint32 item1; uint32 item2; uint32 item3; uint32 item4; <some_other_typedef struct> *table; } Inner_t; typedef struct { Inner_t tableA; Inner_t tableB; } Outer_t; Outer_t outer_instance = { {NULL}, { 0, 1, 2, 3, table_defined_somewhere_else, } }; My question is how to check if tableA is NULL just like the case for outer_instance. It tried: if ( tmp->tableA == NULL ). I get "error: invalid operands to binary =="

    Read the article

  • Basic help needed with pointers (double indirection)

    - by sbsp
    Hi, i asked some time ago on an account i cant remember how to manipulate basic pointers and someone gave me a really good demo for example char *ptr = "hello" (hello = a char array) so now *ptr is pointing at h ptr++ = moves the ptr to point at the next element, to get its value i do *ptr and that gives me e ok so far i hope :D but now i need to manipulate a char **ptr and was wondering how I do this in a way that mimmicks the effects of a 2d array? some basic tips would be much appreciated as I need to do an assignment that has a **ptr to imitate a 2d array and without knowing how it does this first means I cant even solve it on paper (for example, how do you dereference a **ptr, how do you get [x][y] values etc) thanks

    Read the article

  • Using C++ is a Linked-List implementation without using pointers possible or not?

    - by sonicoder
    My question is very simply, can one using C++, implment a link-list data structure without using pointers (next nodes)? To further qualify my question, I'm mean can one create a Linked-List data structure using only class instantiations. A common node definition might be like so: template<typename T> struct node { T t; node<T>* next; node<T>* prev; }; I'm aware of std::list etc, I'm just curious to know if its possible or not - and if so how? code examples will be greatly appreciated.

    Read the article

  • Vector of objects

    - by Paul
    I've got a abstract class class A { public: virtual void somefunction() = ; }; and some different classes that inherit this class: class Ab { public: void somefunction(); }; etc. I want to make a vector containing some objects of these classes (how many depends on input parameters) so I can access these easily later. However I'm a bit lost on how to do this. My best idea is vector<A> *objectsVector; Ab AbObject; objectsVector.push_back(AbObject); However this gives me a huge amout of errors from various .h files in /usr/include/c++ How should i solve this?

    Read the article

  • Converting a const char* into a double

    - by Koning Baard
    I am trying to convert a const char* to a double precision floating point number: int main(const int argc, const char *argv[]) { int i; double numbers[argc - 1]; for(i = 1; i < argc, i += 1) { /* -- Convert each argv into a double and put it in `number` */ } /* ... */ return 0; } Can anyone help me? Thanks

    Read the article

  • How do game trainers change a address in memory thats dynamic?

    - by GameTrainersWTF
    Lets assume i am a game and i have a global int* that contains my health. A game trainers job is to modify this value to whatever in order to achieve god mode. I've looked up tutorials on game trainers to understand how they work, and the general idea is to use a memory scanner to try and find the address of a certain value. Then modify this address by injecting a dll or whatever. But i made a simple program with a global int* and its address changes every time i run the app, so i don't get how game trainers can hard code these addresses? Or is my example wrong? What am i missing?

    Read the article

  • How do game trainers change an address in memory that's dynamic?

    - by GameTrainersWTF
    Lets assume I am a game and I have a global int* that contains my health. A game trainer's job is to modify this value to whatever in order to achieve god mode. I've looked up tutorials on game trainers to understand how they work, and the general idea is to use a memory scanner to try and find the address of a certain value. Then modify this address by injecting a dll or whatever. But I made a simple program with a global int* and its address changes every time I run the app, so I don't get how game trainers can hard code these addresses? Or is my example wrong? What am I missing?

    Read the article

  • C++ sort array of char pointes

    - by user69514
    Can you tell me what's wrong with my method? I ends up putting the same thing everywhre and it's actually not sorting. void sortArrays(){ int i, j; for(i=0; i<counter; i++){ for( j=0; j<i; j++){ if( strcmp(title_arr[i], title_arr[j]) < 0){ char* title_temp = title_arr[i]; title_arr[j] = title_temp; } } }

    Read the article

  • Converting a string into a double

    - by Koning Baard
    I am trying to convert a string (const char* argv[]) to a double precision floating point number: int main(const int argc, const char *argv[]) { int i; double numbers[argc - 1]; for(i = 1; i < argc; i += 1) { /* -- Convert each argv into a double and put it in `number` */ } /* ... */ return 0; } Can anyone help me? Thanks

    Read the article

  • Heap Error in C++

    - by BobAlmond
    Dear all, I'm a beginner programmer in C++. Recently, I'm working on image processing thing using C++. but I have some problem that I want to ask. Suppose I have some code as follow: for (int i=0;i<100000;i++) { int * a = new int[10000]; //do something delete [] a; } When I executed that code, I receive runtime error, Heap Error... Is there anything wrong with that code, I mean, can I allocate memory and release it in the same loop? Thanks in advance...

    Read the article

  • C++ sort array of char pointers

    - by user69514
    Can you tell me what's wrong with my method? I ends up putting the same thing everywhre and it's actually not sorting. void sortArrays(){ int i, j; for(i=0; i<counter; i++){ for( j=0; j<i; j++){ if( strcmp(title_arr[i], title_arr[j]) < 0){ char* title_temp = title_arr[i]; title_arr[j] = title_temp; } } }

    Read the article

  • Getting touchpad to work in desktop ubuntu

    - by kamziro
    I bought a small touchpad to stick on top of the keyboard, and it works fine on the windows computer, but not on my ubuntu desktop. I mean, when I do "xinput list" it shows the following: ? Virtual core pointer id=2 [master pointer (3)] ? ? Virtual core XTEST pointer id=4 [slave pointer (2)] ? ? PIXART USB OPTICAL MOUSE id=8 [slave pointer (2)] ? ? Logitech USB-PS/2 Optical Mouse id=11 [slave pointer (2)] ? ? Microsoft Wired Keyboard 600 id=13 [slave pointer (2)] ? ? Macintosh mouse button emulation id=14 [slave pointer (2)] ? ? Cirque Corporation 9925 AG Touchpad id=15 [slave pointer (2)] ? Virtual core keyboard id=3 [master keyboard (2)] ? Virtual core XTEST keyboard id=5 [slave keyboard (3)] ? Power Button id=6 [slave keyboard (3)] ? Power Button id=7 [slave keyboard (3)] ? No brand SP04-A1 id=9 [slave keyboard (3)] ? Elite Silicon USB Audio Device id=10 [slave keyboard (3)] ? Microsoft Wired Keyboard 600 id=12 [slave keyboard (3)] The Cirque Corporation touchpad (I'm assuming that's the component name) is the touchpad. Is there anything I'm missing?

    Read the article

  • Why we used double and triple pointer in objective-C or C language?

    - by Rajendra Bhole
    Hi, I confused when i want to take single pointer and when should i take double pointer? In following structure what exactly did? struct objc_class { Class isa; Class super_class; const char *name; long version; long info; long instance_size; struct objc_ivar_list *ivars; struct objc_method_list **methodLists; struct objc_cache *cache; struct objc_protocol_list *protocols; }; Why we use the "**methodLists" double pointer. Edited int sqlite3_get_table( sqlite3 *db, const char zSql, char **pazResult, int *pnRow, int *pnColumn, char *pzErrmsg ); In above scenario what will be meaning of triple pointer char **pazResult?

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >