Search Results

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

Page 8/144 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Initialize void pointer to point to an array

    - by idealistikz
    Suppose I have the following: typedef struct { int itemSize; int count; void *list; } Mystruct; Mystruct *InitStruct(int itemSize, int count) { Mystruct *my = malloc(sizeof(Mystruct)); my->itemSize = itemSize; my->count = count; //What is the best way to initialize list? For example: //my->list = malloc(count * sizeof(void *)); OR //my->list = malloc(count * sizeof(itemSize)); } //The following should return a pointer to the element stored at a given index void *Retrieve(const MyStruct *my, int index) { void *item; //What is the best way to return a pointer to the item at the given index from //my->list? } Mystruct is similar to an array and void *list is supposed to store the elements or pointers to the elements. Mystruct *InitStruct is a function that initializes a Mystruct pointer and void *Retrieve is a function that returns a pointer to the element stored at a given index. First, how should I initialize void* list? Should it hold the actual elements or be an array of pointers pointing to the elements? Second, using the void *Retrieve function, how do I return a pointer to the element stored at a given index in my-list?

    Read the article

  • When is "this" pointer initialized in C++?

    - by skydoor
    Hi I have a question about this pointer, when an object is constructed, when it is initialized? Which means, when can I use it? The virtual table is constructed in the constructor, is the same with this pointer? For example, I have a code like this. The output is 8. Does it mean that before the constructor is entered, this pointer is already initialized? class A{ public: A() { cout<<sizeof(*this);} int i; int *p; }; int main() { A a; } If it is true, what else would happen before the constructor is entered? If it is not true, when is the this pointer initialized?

    Read the article

  • Workstation 7 build 203739 - Capture Movie Mouse Pointer Not Visible

    - by BMIVM
    Hi, I have noticed that whenever I create a Capture Movie, the movie is fine but the mouse pointer is not visible at all. The clicks are on buttons file menus are executed but is hard for a viewer of the capturre movie session to follow the recording smoothly. This was not a problem in previous versions of WorkStation. Is this a bug or is there a setting I can set to see the mouse pointer? Note: VM Tools are installed, Host is Vista Ultimate Edtion SP1, x64 and the guest is a Win XP SP2. Thanks in advance for your help.

    Read the article

  • VMware Workstation 7 build 203739 - Capture Movie Mouse Pointer Not Visible

    - by BMIVM
    Hi, I have noticed that whenever I create a Capture Movie, the movie is fine but the mouse pointer is not visible at all. The clicks are on buttons file menus are executed but is hard for a viewer of the capturre movie session to follow the recording smoothly. This was not a problem in previous versions of WorkStation. Is this a bug or is there a setting I can set to see the mouse pointer? Note: VM Tools are installed, Host is Vista Ultimate Edtion SP1, x64 and the guest is a Win XP SP2. Thanks in advance for your help.

    Read the article

  • Need alternative to Accessibility's "Locate Pointer" to visually highlight the mouse.

    - by fred.bear
    Update: See end of quetion: A black-on-white cross-hair/I-bar mouse-pointer is soemtimes hard foe me to spot in amongst black-on-white text. I've tried "Accessibility / Mouse Accessibility / Locate Pointer" .. which will: Show pointer position when Control is presssed It works (to a point), but it does have a notable problem, which renders it inpractical. It has the uncanny side-effect of disallowing all Control key navigation while editing a file/dir name in Nautilus (F2).. Just touching the Control key drops it out of edit mode, which means I can't keyboard paste, move-L/R word etc... So, I'm looking for an alternative. I've tried Compiz's Water Effect, but I need something which is sharper, faster, and localized to the pointer. Compiz's Show Mouse (with fire) is no suitable. I'm really lookingf for an analog of "Accessibility / Locate Pointer": * ie. I hit Control (only).. and it blips a quick visual pulse. UPDATE: I've just realized why I can't find my mouse so often! ... It's because it is isn't there !!! ... Two apps I use a lot, Gedit and Konsole (KDE Terminal; it renders unicode better), ... dissolve the mouse-pointer to invisible after the first key is typed ... and Konsole does it after a few seconds of idle-time... like a video-player option: "hide the mouse".. Well I don't use the mouse much, and I thought it was juse my eyesight (which does rely a lot on Compiz's zoom)... I discovered it when I installed a "novelty" app, called Geyes from gnome-applets ("A goofy set of eyes for the GNOME panel. They follow your mouse.") ... It could follow the mouse better than me! :)

    Read the article

  • Tech Article: Tired of Null Pointer Exceptions? Use Java SE 8's Optional!

    - by Tori Wieldt
    A wise man once said you are not a real Java programmer until you've dealt with a null pointer exception. The null reference is the source of many problems because it is often used to denote the absence of a value. Java SE 8 introduces a new class called java.util.Optional that can alleviate some of these problems. In the tech article "Tired of Null Pointer Exceptions? Use Java SE 8's Optional!" Java expert Raoul-Gabriel Urma shows you how to make your code more readable and protect it against null pointer exceptions. Urma explains "The purpose of Optional is not to replace every single null reference in your codebase but rather to help design better APIs in which—just by reading the signature of a method—users can tell whether to expect an optional value. In addition, Optional forces you to actively unwrap an Optional to deal with the absence of a value; as a result, you protect your code against unintended null pointer exceptions." Learn how to go from writing painful nested null checks to writing declarative code that is composable, readable, and better protected from null pointer exceptions. Read "Tired of Null Pointer Exceptions? Use Java SE 8's Optional!"

    Read the article

  • mouse pointer moving on its own

    - by PA
    After two months of working correctly, I am experiencing an strange and very annoying problem. My mouse pointer is moving on its own. If I move the mouse to the left, as soon as I stop the movement, the pointer runs again to the far right. This makes the mouse totally unusable. The mouse device is an optical USB mouse. It is not a problem with the mouse itself. I have tried with another mouse, same problem. (both mice are OK, I have tried both mice on my laptop, both worked perfectly) Have tried different surfaces, too. Same problem. System is Windows XP Pro SP3. Computer is a desktop PC two months old. I suspected it could be a problem with the mouse driver. But both mice are from different brand, so I suppose they use different drivers. What else can I try? any suggestion?

    Read the article

  • Why Garbage Collection if smart pointers are there

    - by Gulshan
    This days, so many languages are garbage collected. Even it is available for C++ by third parties. But, C++ has RAII and smart pointers. So, what's the point of using garbage collection? Is it doing something extra? And in other languages like C#, if all the references are treated as smart pointers(keeping RAII aside), by specification and by implementation, will there be still any need of garbage collectors? If no, then why this is not so?

    Read the article

  • Implementing a list with unique_ptr<>? [migrated]

    - by Alexander Duchene
    As I understand it, a unique_ptr signifies exclusive ownership. A singly linked list seems to fit this, with each node owning the next, like (pseduocode alert) class node{ public: unique_ptr<node> next; int value; }; but I don't understand how to perform operations like traversing the list, where I'm used to doing here=here->next; How do you implement data structures using unique_ptr's? Are they the right tool for the job?

    Read the article

  • Fixed mouse pointer with jQuery draggable

    - by MikeWyatt
    I'm building a little game in HTML5. The canvas element is a viewport into the game world. The user can move the viewport's position in the world by clicking and dragging with the mouse on a small icon. The problem is that the scrolling stops when the mouse pointer hits the edge of the screen. In all likelihood, that will limit scrolling in one of the directions severely, since the icon will be in one of the corners of the page. The only technical solution I can think of would be to somehow fix the mouse pointer's position on the icon and detect the relative movement each frame. Basically I would just reset the pointer position back to the center of the icon after each drag event. Unfortunately, I'm fairly positive that this is not possible. Playing with the user's pointer is a big no-no from a usability and security standpoint. So, is there any other way to do what I want? I'm primarily looking for technical ideas here, but suggestions for a more appropriate interface would also be welcome.

    Read the article

  • A Question about dereferencing pointer to incomplete type In C programming

    - by user552279
    Hi, can you explain this error for me? Blockquote /////////////////////////////// In my A.h file: struct TreeNode; struct TreeHead; typedef struct TreeNode * Node; typedef struct TreeHead * Head; /////////////////////////////// In my A.c file: struct TreeNode { char* theData; Node Left; Node Right; } ; struct TreeHead{ int counter; char type; Node Root; }; Head Initialisation() { Head treeHead; treeHead = malloc(sizeof (struct TreeHead)); treeHead-Root = malloc(sizeof (struct TreeNode)); return treeHead; } /////////////////////////////// In my Main.c file: Head head; Node tree; int choose =5; head = Initialisation(); (head-Root) = tree; //When compiling, this line has an error: error: dereferencing pointer to incomplete type Blockquote haed-Root will return a Node pointer, tree is also a Node pointer. So why error is dereferencing pointer to "incomplete" type?

    Read the article

  • Windows 8 black screen with mouse pointer after login

    - by Sagar Juneja
    I restarted my system today and after logging in, i could see see nothing but a black screen with mouse pointer. I can start task manager via alt+ctrl+del, Task manager and msconfig show fine but when i try to run 'explorer' nothing happens. In safe mode everything seems fine. I do not have any system restore points and repair options from the DVD show "this option is not available for the selected OS" I've also updated my graphic drivers. Didn't help

    Read the article

  • delete pointer to 2d array c ++

    - by user1848054
    i have this pointer to 2d array of Robot class Robot ***rob; and this is here the code for the constructor !! and the program works fine !!! but now i am trying to build a destructor to delete this pointer !! and it keeps on crashing the program !! my question is , how to delete this pointer to 2d array of robots ? RobotsWorld::RobotsWorld(int x , int y) { X=x;Y=y; // returns the limitation of the matrix rob = new Robot**[x]; for(int i = 0; i < x; i++) { rob[i] = new Robot*[y]; for(int j = 0; j < y; j++) { rob[i][j] = NULL; } } }

    Read the article

  • pointer reference type

    - by Codenotguru
    I am trying to write a function that takes a pointer argument, modifies what the pointer points to, and then returns the destination of the pointer as a reference. I am gettin the following error: cannot convert int***' toint*' in return| Code: #include <iostream> using namespace std; int* increment(int** i) { i++; return &i;} int main() { int a=24; int *p=&a; int *p2; p2=increment(&p); cout<<p2; } Thanks for helping!

    Read the article

  • Handling pointer while updating a key value in rpgle

    - by abhinav singh
    my code goes like this femp uf e k disk dvar1 s 5p 0 c *loval setll emp c read emp c dow not %eof(emp) C eval ecode = ecode + 10 c eval var1=ecode c update recemp c var1 setgt emp c read emp c enddo c eval *inlr=*on here is a file named emp with record format name recemp with ecode as the key ...now when i am reading the file and then updating the ecode without using setgt ..the pointer is not moving ahead it is updating the same ecode value many time ...now when i use set gt pointer picks the next record but it dint work when two ecode values are same ...else also it will not be working with descending key values...is there any solution so that i can set pointer regardless of the fact whether the values are same or ascending or descending .......thanks

    Read the article

  • Does copy_from_user modify the user pointer?

    - by Michael
    Does the copy_from_user function, declared in uaccess.h, modify the (void __user *)from pointer? The pointer isn't declared as const in the function declaration, only the contents it points to. The reason I ask is that I want to use copy_from_user twice, with the second copy_from_user copying from the place where the first one finished. I was planning on doing something like this, is it guaranteed to work? //buf is a user pointer that is already defined copy_from_user(my_first_alloced_region, buf, some_size); //do stuff copy_from_user(my_second_alloced_region, buf + some_size, some_other_size); Thanks in advance.

    Read the article

  • Double pointer as Objective-C block parameter

    - by George WS
    Is it possible (and if so, safe) to create/use a block which takes a double pointer as an argument? For instance: - (void)methodWithBlock:(void (^)(NSError **error))block; Additional context, research, and questions: I'm using ARC. When I declare the method above and attempt to call it, XCode autocompletes my method invocation as follows: [self methodWithBlock:^(NSError *__autoreleasing *error) {}]; What does __autoreleasing mean here and why is it being added? I presume it has something to do with ARC. If this is possible and safe, can the pointer still be dereferenced in the block as it would be anywhere else? In general, what are the important differences between doing what I'm describing, and simply passing a double pointer as a method parameter (e.g. - (void)methodWithDoublePointer:(NSError **)error;)? What special considerations, if any, should be taken into account (again assuming this is possible at all)?

    Read the article

  • Malloc to a CGPoint Pointer throwing EXC_BAD_ACCESS when accessing

    - by kdbdallas
    I am trying to use a snippet of code from a Apple programming guide, and I am getting a EXC_BAD_ACCESS when trying to pass a pointer to a function, right after doing a malloc. (For Reference: iPhone Application Programming Guide: Event Handling - Listing 3-6) The code in question is really simple: CFMutableDictionaryRef touchBeginPoints; UITouch *touch; .... CGPoint *point = (CGPoint *)CFDictionaryGetValue(touchBeginPoints, touch); if (point == NULL) { point = (CGPoint *)malloc(sizeof(CGPoint)); CFDictionarySetValue(touchBeginPoints, touch, point); } Now when the program goes into the if statement it assigns the 'output' of malloc into the point variable/pointer. Then when it tries to pass point into the CFDictionarySetValue function it crashes the application with: Program received signal: “EXC_BAD_ACCESS”. Someone suggested not doing the malloc and pass the point var/pointer as: &point, however that still gave me a EXC_BAD_ACCESS. What I am (and it looks like Apple) doing wrong??? Thanks in advance.

    Read the article

  • Add C pointer to NSMutableArray

    - by Georges Oates Larsen
    I am writing an Objective-C program that deals with low level image memory. I am using ANSI-C structs for my data storage -- Full blown objects seem overkill seeing as the data I am storing is 100% data, with no methods to operate on that data. Specifically, I am writing a customizable posterization algorithm which relies on an array of colors -- This is where things get tricky. I am storing my colors as structs of three floats, and an integer flag (related to the posterization algorithm specifically). Everyhting is going well, except for one thing... [actual question] I can't figure out how to add pointers to an NSMutableArray! I know how to add an object, but adding a pointer to a struct seems to be more difficult -- I do not want NSMutableArray dereferencing my pointer and treating the struct as some sort of strange object. I want NSMutableArray to add the pointer its self to its collection. How do I go about doing this? Thanks in advance, G

    Read the article

  • Pointer-based binary heap implementation

    - by Derek Chiang
    Is it even possible to implement a binary heap using pointers rather than an array? I have searched around the internet (including SO) and no answer can be found. The main problem here is that, how do you keep track of the last pointer? When you insert X into the heap, you place X at the last pointer and then bubble it up. Now, where does the last pointer point to? And also, what happens when you want to remove the root? You exchange the root with the last element, and then bubble the new root down. Now, how do you know what's the new "last element" that you need when you remove root again?

    Read the article

  • rewrite a function using only pointer increment/decrement

    - by Richard Nguyen
    can anyone help me rewrite the function i wrote below using only points and pointer increment/decrement? I dont have much experience with pointer so I dont know what to do. void reverse(char * s) { int i, l = strlen(s); char c; for(i = 0; i < (l >> 1); i++) { c = s[i]; s[i] = s[l - i - 1]; s[l - i - 1] = c; } } do not use pointer arithmetic or array notation. any help or hint on how to rewrite the function above is appriciated. Thanks!

    Read the article

  • Returning new base class when the parent class shared pointer is the return type

    - by Ben Dol
    Can you have a parent class shared pointer return type of a function and then return a new child class without it being a shared pointer? I'm not sure how shared pointers work in these situations, do they act like a regular pointer? Here is my example: BaseEventPtr Actions::getEvent(const std::string& nodeName) { if(asLowerCaseString(nodeName) == "action") return new ActionEvent(&m_interface); return nullptr; } ActionEvent is the subclass of BaseEvent in this situation. Cheers!

    Read the article

  • C pointer array scope and function calls

    - by juvenis
    I have this situation: { float foo[10]; for (int i = 0; i < 10; i++) { foo[i] = 1.0f; } object.function1(foo); // stores the float pointer to a const void* member of object } object.function2(); // uses the stored void pointer Are the contents of the float pointer unknown in the second function call? It seems that I get weird results when I run my program. But if I declare the float foo[10] to be const and initialize it in the declaration, I get correct results. Why is this happening?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >