Which library to use to pause the system instead of getch?

Asked

Viewed 1,230 times

1

#include <stdio.h>
#include <conio.h>
int  main()
{
    int x=4, y=7;
    printf("&X:%X &Y:%X x e y (%d,%d)\n",&x,&y,x,y);

    int *px, *py;
    px = & x;
    py = & y;

    printf("px:%X py:%X *px e *py (%d,%d)\n",px,py,*px,*py);
    getch();
  return 0;
}

1 answer

1


  • I use Dev, searching here found that if I add stdlib. h it accepts the system("PAUSE") thanks for the help.

  • Cara . . system("Pause") runs an off-process command - I would say that is the worst possible option.

  • The fact is that no There is a something universally defined in C for a syncopated keyboard reading - but there are calls that pause the program until the reading of a line of stdin - the progress that imprints the instruction for the user to press "enter" and use one of these - anything else is very dirty. More sophisticated programs either will not use a C.L.interface, or are for a public who is already on the command line to run the program.

  • @jsbueno the point is that this is only useful to make a quick test like this, so whatever you’re using. You have to be pragmatic.

  • no - teachers teach this in schools, and students graduate without knowing the difference - it’s not a question of pragmatism and pragmatism. There’s pragmatism scanf();

  • 1

    @jsbueno there almost all answers here will be wrong and the use of scanf() It’s also often criticized. Pragmatic is looking at the context and using what’s simpler for that scenario. If the guy really becomes a C programmer he’ll learn what’s bad in every situation. If he makes this kind of mess he won’t survive 3 days working with that language.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.