Tushar
It will not go inside the other scope inside main()
olli
It will not go inside the other scope inside main()
No... Of course it will. This block isn't even conditional
Mihail
Can I up this post?
looks like a bad way to discard the first line
Mihail
that's what it does, but that probably isn't the best way to do it
Dima
Can you show this file?
Roberto
that's what it does, but that probably isn't the best way to do it
Yes I think so. Do anyone have a better idea to discard the first line of a file?
Roberto
Anonymous
yeah I finished read the rules and I will post about the topics very carefully
Roberto
Indeed the first line is not useful
Mihail
pictures of screens aren't allowed
Mihail
i'll warn you next time
Roberto
Sorryyyyy
Roberto
Ok seems legit
Mihail
Yes I think so. Do anyone have a better idea to discard the first line of a file?
list.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
Mihail
requires <limits>
Roberto
I see, thanks
Dima
Dima
What the.. 🤷‍♀️
Dima
I know maybe this is an assignment/text thing, but don’t you dare to store data like that 😂
Mihail
tbh idk what's worse the way it's stored or the fact it isn't actaully aligned
Roberto
😂
Dima
Roberto
I agree
Anonymous
Ok
Anonymous
Yeah
Anonymous
MᏫᎻᎯᎷᎷᎬᎠ
Lol
Reusability of my thanking function without my permission to is a bad attitude
MᏫᎻᎯᎷᎷᎬᎠ
Sorry
No prob
professor
why it works with letters and not numbers? int game(int user_pick) { int rand_pick; if ((user_pick < 1) || (user_pick > 32000)) { printf("Playing the game of chance..\n"); rand_pick = (rand() % 32000) + 1; printf("You picked: %d\n", user_pick); printf("Random Value: %d\n", rand_pick); if (user_pick == rand_pick) jackpot(); else printf("Sorry, you didn't win this time..\n"); } else { printf("You must pick a value from 1 - 32000\n"); printf("Use help or -h for help\n"); return 0; } } int jackpot() { printf("You just won!\n"); printf("Congratulations!\n"); return 0; } void foo(char* input) { int(*function_ptr) (int user_pick); char buffer[20]; srand(time(NULL)); function_ptr = game; strcpy(buffer, input); if ((!strcmp(buffer, "help")) || (!strcmp(buffer, "-h"))) { printf("Help Text:\n\n"); printf("This is a game of chance.\n"); printf("To play, simply guess a number 1 through 32000\n"); printf("If you guess the number I am thinking of you win.\n"); } else function_ptr(atoi(buffer)); } int main(int argc, char* argv[]) { if (argc < 2) { printf("Usage: %s <a number 1 - 32000>\n", argv[0]); printf("use %s help or %s -h for more help.\n", argv[0], argv[0]); exit(0); } foo(argv[1]); return 0; } C:\Users\xxxx>C:\Users\xxxx\Desktop\functionoverwrite.exe 1 You must pick a value from 1 -32000 Use help or -h for help C:\Users\xxxxx>C:\Users\xxxx\Desktop\functionoverwrite.exe aa Playing the game of chance.. You picked: 0 Random Value: 7181 Sorry, you didn't win this time..
olli
why it works with letters and not numbers? int game(int user_pick) { int rand_pick; if ((user_pick < 1) || (user_pick > 32000)) { printf("Playing the game of chance..\n"); rand_pick = (rand() % 32000) + 1; printf("You picked: %d\n", user_pick); printf("Random Value: %d\n", rand_pick); if (user_pick == rand_pick) jackpot(); else printf("Sorry, you didn't win this time..\n"); } else { printf("You must pick a value from 1 - 32000\n"); printf("Use help or -h for help\n"); return 0; } } int jackpot() { printf("You just won!\n"); printf("Congratulations!\n"); return 0; } void foo(char* input) { int(*function_ptr) (int user_pick); char buffer[20]; srand(time(NULL)); function_ptr = game; strcpy(buffer, input); if ((!strcmp(buffer, "help")) || (!strcmp(buffer, "-h"))) { printf("Help Text:\n\n"); printf("This is a game of chance.\n"); printf("To play, simply guess a number 1 through 32000\n"); printf("If you guess the number I am thinking of you win.\n"); } else function_ptr(atoi(buffer)); } int main(int argc, char* argv[]) { if (argc < 2) { printf("Usage: %s <a number 1 - 32000>\n", argv[0]); printf("use %s help or %s -h for more help.\n", argv[0], argv[0]); exit(0); } foo(argv[1]); return 0; } C:\Users\xxxx>C:\Users\xxxx\Desktop\functionoverwrite.exe 1 You must pick a value from 1 -32000 Use help or -h for help C:\Users\xxxxx>C:\Users\xxxx\Desktop\functionoverwrite.exe aa Playing the game of chance.. You picked: 0 Random Value: 7181 Sorry, you didn't win this time..
you probably want if ((user_pick >= 1) && (user_pick <= 32000)) instead of if ((user_pick < 1) || (user_pick > 32000)) ?
professor
let me check it
professor
C:\Users\blackleitus>C:\Users\blackleitus\Desktop\functionoverwrite.exe aa Playing the game of chance.. You picked: 0 Random Value: 13215 Sorry, you didn't win this time.. C:\Users\blackleitus>C:\Users\blackleitus\Desktop\functionoverwrite.exe 22 Playing the game of chance.. You picked: 22 Random Value: 13225 Sorry, you didn't win this time..
professor
it should if I write aa back to printf("Usage: %s <a number 1 - 32000>\n", argv[0]);
professor
I fix it like this user_pick > 0 && user_pick <= 32000
Mihail
I fix it like this user_pick > 0 && user_pick <= 32000
that'll always be true as long as user_pick <= 32000
Mihail
what is that if meant to do?
Wim
If the user picked a number, tell which number the user picked, so to see?
Pro
No prob
🐸🐸
MᏫᎻᎯᎷᎷᎬᎠ
🐸🐸
What thaaaa
MᏫᎻᎯᎷᎷᎬᎠ
So Now you are a C++ developer
Pro
What thaaaa
In ur face bond 😹😹😹😹
professor
how can I disbale all protections on devc++ at compiler?
Anonymous
I want to learn c and c++ program anyone can teach me🙏
Anonymous
Google can😁
🙁🙁...
Anonymous
😑
Daniele°
was abandoned by its developers in 2005
professor
Dev-c++ Is shit
I use because no security built in exes
Daniele°
professor
It is easy to build software exploitation for new people
professor
Dev-c++ Is not a compiler
It is a gui for compiler
Daniele°
Move on a modern compiler
Ariana
Daniele°
If you use a Windows the best choise is Visual Studio
professor
I could find the solution using cl
Ariana
firstly, why would you want to do that
professor
I like to break software 😂
professor
It is fun how software developers think it is so secure
Ariana
aslr can be disabled depending on what os you’re using the rest ik gcc -fno-stack-protector -z execstack
Ariana
Dude
Ariana
it is enabled to make it secure
Ariana
aslr can be disabled depending on what os you’re using the rest ik gcc -fno-stack-protector -z execstack
oh but the weird esp thingy before return im not sure how to disable that trash
professor
Nx, aslr , cookies , doesnt stop arbitrary code
Ariana
it does
Ariana
Nx prevents wx
Ariana
Meaning only chance is rop or jop
professor
Nx = rop gadgets , aslr=2 byte overwrite, bruteforce address, non-aslr
Ariana
alsr makes it such that you need to find like a libc leak
Ariana
Wtf