Sublime Forum

Scanf not considered

#1

Hello,

Where I run my code, the scanf function is not considered and the user can’t enter any data.

Here is my code :

*]#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#define max 10

int main (){
int var;
printf(“Entrer une valeur : “);
scanf(”%d”, &var);
printf(“voici la valeur saisie : %d\n”, var);
return (0);
}

And this is the result :

Entrer une valeur : voici la valeur saisie : 0
[Finished in 0.1s]

0 Likes

#2

The user is not invited to enter de data. Nobody can help me ?

0 Likes

#3

this in not an sublime text related question but general programming one. you mights have better luck asking on stack overflow.

0 Likes

#4

The problem is happening ONLY with sublime text, then it is a sublime text problem and not a general one.

0 Likes

#5

Nobody can help me…

0 Likes

#6

Sublime is not a compiler; therefore, it can’t change your code to not work. It is just an editor.

Maybe you are referring to using sublime’s build environment, but it is set up incorrectly so your code is compiling wrong?

You really need to be very specific with your questions or no one can help you. Right now it just sounds like a coding problem.

0 Likes

#7

It is not a coding problem it is 100% sure, look at this :

int variable; scanf("%d", &variable);

What is wrong here ? Nothing. The point is that the user cannot enter any data. The code is run until the end without asking the user to enter any data. What is not clear in my question ?

0 Likes

#8

As far as I know, Sublime Text doesn’t support user input. Your best bet is probably to use Sublime Text’s Build System to compile your program and then your native command prompt to run it. The Terminal plugin might be useful here, too.

0 Likes

#9

ok I see, I thing I will use gcc from terminal to execute my program --> ./myProgram .

Thanks for your help.

0 Likes

Can somebody help me?