Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7841729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:09:41+00:00 2026-06-02T16:09:41+00:00

So I’m working with an API which really isn’t as functional as it could

  • 0

So I’m working with an API which really isn’t as functional as it could be. (Quickhaptics to be specific) In order to make something that I have work, I need to delete an object within a structure, create it again, (without using new, because the constructor for the object doesn’t work the way I need it to) then set it to something.

I’m trying to do something along the lines of

delete data.cursor;
Cursor* data.cursor = (Cursor*)malloc(sizeof(Cursor));
data.cursor = data.cursors[index];

But this causes a crash(EDIT sorry, it doesn’t compile is what I meant to say, but I don’t understand the compiler errors)

Additional info: The way the API works, I need to send it a pointer to an item, which it takes initially and writes information to throughout execution. I’m trying to update the mesh on a cursor type object. It provides update functions to load in new meshes, but they are very expensive and can only run at ~3 fps. My solution is to load the objects into an array at startup, then just switch out the object that the program looks for as a cursor.

I’m generally new to C++, and my experience is all from sitting down and typing with no instruction, so there may be some basic C++ thing that I’m missing.

EDIT: Just to be clear, doing this works, just very slowly

delete data.cursor;
data.cursor = new Cursor("filename");

where data.cursors[index] was declared in teh same exact way at startup

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:09:42+00:00Added an answer on June 2, 2026 at 4:09 pm

    It doesn’t compile because you’re trying to declare a member:

    delete data.cursor;
    Cursor* data.cursor = (Cursor*)malloc(sizeof(Cursor));
    

    is illegal, it should be:

    delete data.cursor;
    data.cursor = (Cursor*)malloc(sizeof(Cursor));
    

    Also, since cursor is a pointer, doing

    data.cursor = data.cursors[index];
    

    will make the pointer point to that memory, so the previously allocated memory (via malloc(sizeof(Cursor)); will be leaked. You’re probably looking for a memcpy here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.