Limit a specific value to a string

-3

I need to limit to a specific value that would be 511

char command[512];

I tried with

char command[512]; 
scanf("%511s",command);
if (StrToInt(command))>511)
printf("FIX ATK");

and this too

char command[512]; 
scanf("%511s", command);
if (strlen(command) > 511)
printf("FIX ATK");

And I did not succeed, does anyone know how to solve it?

    
asked by anonymous 12.12.2017 / 14:59

1 answer

-1

Good. here you must define if you want value to be less than 512

  

if (StrToInt (command)) > 511)

or if you want the string length to be less than 512.

  

if (strlen (command)> 511)

Anyway, to convert string to integer in c ++, you should use std :: stoi.

I think you should explain your question better

    
12.12.2017 / 15:20