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 6974687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:16:13+00:00 2026-05-27T17:16:13+00:00

To produce millisecond using clock function after strcat but it simply crash, what could

  • 0

To produce millisecond using clock function after strcat but it simply crash, what could be the problem?

FREObject result = 0;

uint32_t len = -1;
const uint8_t *str = 0;
char *temp = "Millisecond: ";
uint8_t *strAll;

clock_t curtime = clock();

double *asc = (double *) curtime;  //Using double datatype?

if(FREGetObjectAsUTF8(argv[0], &len, &str) == FRE_OK) {

  strAll = (char *)malloc(strlen(temp) + strlen(str) + 1 + strlen(asc) + 1);
  strcpy(strAll,temp);
  strcat(strAll,str);
  strcat(strAll," ");
  strcat(strAll,(char *)asc);  //Is this correct?
}

FRENewObjectFromUTF8(strlen((const char *)strAll)+1, (const uint8_t *)strAll, &result);         

return result;
  • 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-05-27T17:16:13+00:00Added an answer on May 27, 2026 at 5:16 pm

    The assignment to asc is extremely dubious:

    double *asc = (double *) curtime;  //Using double datatype?
    

    You can measure the difference between two clock() values, to determine the processor time used.

    You might get more nearly successful results with:

    double asc = curtime;
    

    The strlen() operation is undefined – under either definition of asc:

    strAll = (char *)malloc(strlen(temp) + strlen(str) + 1 + strlen(asc) + 1);
    

    Then the strcat() operation is going fail horribly; you have to convert the double to a string before you can concatenate the string to another.

    strcat(strAll,(char *)asc);  //Is this correct?
    

    So, you have a lot of work to do. You need to decide whether clock() is the right system call. If it is, you have to fix the sizing and the conversion of asc or curtime to a string before you concatenate it to the result.

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

Sidebar

Related Questions

I produce json using resteasy. Everything works fine but... I can't order the parameters
I'm trying to produce sheets of photographs with captions arranged in a grid using
I'm trying to produce a report that has multiple grouping but does not just
I would like to produce an executable that could make an update verification before
I produce a complex HTML summary report from data in a database which could
Could pls explain why I' not able to get valid result ( with precision
I am trying to produce some example graphics using ggplot2, and one of the
I produce a report as an CSV file. When I try to open the
I produce server software and have been fine with all Linux environments so far,
I need to produce a calculation trace file containing tabular data showing intermediate results.

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.