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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:26:31+00:00 2026-05-22T11:26:31+00:00

I am modifying a program that runs in Windows that I would like to

  • 0

I am modifying a program that runs in Windows that I would like to input a couple of values into as it starts.

At the beginning of AppMain, the following pre-existing code allows the user to enter a filename:

char our_file_name[260] = "TEST";

#ifdef WIN32
edit_dialog(NULL,"Create File", "Enter file name:", our_file_name,260);
#endif

This all seemed rather straightforward so I thought I’d just recreate this for my (signed) integer values, with the following code, inserted immediately following the above code:

#ifdef WIN32
edit_dialog(NULL,"Custom tolerance", "Enter tolerance:", tolerance,260);
#endif

#ifdef WIN32
edit_dialog(NULL,"Custom position", "Enter intended position:", position,260);
#endif

… And the following placed with the other variable declarations:

int tolerance = 400;
int position = 0;

The code compiles just fine, but when I run the program, the filename section works just as it should but the program crashes as soon as this new bit starts to run.

What am I doing wrong? Is there a better method of inputting a couple of values?

  • 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-22T11:26:31+00:00Added an answer on May 22, 2026 at 11:26 am

    The signature for the edit_dialog function probably takes a char* as it’s 4th parameter. You are passing an int there when you call it with tolerance, so your code is treating the value of the int (in this case 400) as a pointer value (0x400) and going to look at the string located at the address 0x400… Boom. Crash.

    You need to write the integer value to a character buffer before you pass it in to the edit_dialog function.

    char buf[256];
    sprintf( buf, "%d", tolerance);
    #ifdef WIN32
    edit_dialog(NULL,"Custom tolerance", "Enter tolerance:", buf, 260);
    #endif
    

    (I bet edit_dialog is a macro, because I’m pretty sure most compilers would catch this error at compile time and warn you).

    Then when your edit dialog comes back, it will store the characters the user typed back into buf which you’ll probably want to convert to an int.

    tolerance = atoi(buf);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like some kind of delete/copy/move/etc Windows commands that completely ignores if a
I have a command line application that runs on a windows server. The command
Would it be better to transpose a Microsoft .NET program to standalone by modifying
I used to think that metaprogramming involved modifying the program, and (as do some
The following program is accessing and modifying a private field named privateKey declared within
In my program I have currently a piece of code that looks like this
I am modifying some code and came across a declaration that I am having
i have written a c program to which i pass in a script like
I have a python program that imports pythoncom (and uses pythoncom.CoCreateInstance from it). I
I have a .net windows forms application that needs to open directly to the

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.