Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rank2, ft_atoi_base is wrong? #34

Open
Lineath opened this issue Aug 3, 2023 · 1 comment
Open

Rank2, ft_atoi_base is wrong? #34

Lineath opened this issue Aug 3, 2023 · 1 comment

Comments

@Lineath
Copy link

Lineath commented Aug 3, 2023

I think this is wrong, what do you whink?

Seem that you are using atoi_base from piscine exercices, its not the same in the exam!

./a.out "Ceci permet de decouvrir le fonctionnement de ton ft_atoi_base." "16" 🗝 EXPECTED OUTPUT: 3308$

Seems that you are triming the string to the first valid part ("Cec" 0x3308), like the subject of the piscine. but the exam subject is different:

`
Write a function that converts the string argument str (base N <= 16)
to an integer (base 10) and returns it.

The characters recognized in the input are: 0123456789abcdef
Those are, of course, to be trimmed according to the requested base. For
example, base 4 recognizes "0123" and base 16 recognizes "0123456789abcdef".

Uppercase letters must also be recognized: "12fdb3" is the same as "12FDB3".

Minus signs ('-') are interpreted only if they are the first character of the
string.

Your function must be declared as follows:

int ft_atoi_base(const char *str, int str_base);
`

I think the whole string (where aplicable) must ve converted then manage any error (int ranges etc), i just failed the real exam on this, asked the staff but no luck, they wont answer...

@Lineath
Copy link
Author

Lineath commented Aug 3, 2023

Want to add:

Its even worse, exam subject do not let you return anything except a valid 32 int, so no error management (exit codes) or -1, nothing. A string like "Ceci permet de decouvrir le fonctionnement de ton ft_atoi_base.", its gonna generate BIG numbers outside int range.

"...string argument str (base N <= 16) to an integer (base 10) and returns it..."

Seems that str argument can only contain characters that fit on base 16 or less?? what about big numbers? lets say "FFFFFFFFFFFF" (281.474.976.710.655) this way out of range, but you are no allowed to return nothing but "int".

I dont get it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant