Oleksandr
-p flag force create nested dirs
Anonymous
Maybe my computer is going bonkers so I will buy a new one
Vladimir
rm -rf is a good advice, because normally rm refuses to delete directory with files inside
Vladimir
Also it can produce error if you try to rm what is not exist
Vladimir
So add -f flag to all 'rm' commands
Anonymous
Ok
Oleksandr
@k_vark будет кого матюкать по-русски :DD
kvark
Dima
Бле
Vladimir
Please don't ruin this chat by your non-ascii symbols.
Dima
Добро пожаловать в индусскую общину. Желательно говорить по-английски
Dima
Yeah
Dima
It’s against the rules
Vladimir
Not like I don't understand, I have plenty of rus chats without this.
kvark
sorry, just local jokes)
Oleksandr
lock
lock
I think the error is in the removeSpaces() function
Dima
But I have just notified
lock
The value of RIP when the program closes unexpectly is <removeSpaces+21>
Oleksandr
lock
But what's the error
Oleksandr
what are u realy want, when init int var by pointer?
lock
Think it is a pointer problem while moving through addresses
Oleksandr
But what's the error
1) init int variable by char** value
2) iterate throw char** in while loop instead of char*
3) compare pointers instead of values (i.e. *str == "A")
4) init char* field by char const* variable (in *str = "B")
Oleksandr
Vladimir
For the god sake, what is the meaning of that "A" and "B"?!
lock
Just a test to check if the replacement is working
Dima
Lol!
lock
To test I'm using as argv[1] ABABABAAABAA to check if A's are converted to B's
Oleksandr
that bot are scaring me
lock
Ok, I'll try to do that
lock
thanks all of you for helping!
Oleksandr
Vladimir
Vladimir
Also I can use stack-base array.
He is using one.
Vladimir
No syscalls.
Vladimir
If we have a limitation to not use second array, algo will be:
1. Find space
2. Count how many spaces till non-space
3. memmove from non-space to first space position.
4. Loop 1-3 till the end of string.
Oleksandr
just for fun
#include <iostream>
#include <algorithm>
int main(int ac, char **av)
{
char str[] = "qweqweqeqw qwe qw wq eq";
std::string obj(str);
obj.erase(std::remove(std::begin(obj), std::end(obj), ' '), std::end(obj));
std::cout << obj << std::endl;
return(0);
}
Vladimir
std-cheater
Oleksandr
std:: in our hearts❤️
lock
Vladimir
lock
Yep it works
lock
[*] Removing spaces of string: chicweawnovn edwev rer t
[+] Out string: chicweawnovnedwevrert
Oleksandr
it works, but he cut-off array
lock
Oleksandr
last iteration of do_while loop whill set '\0', potentialy, at the mid of array
Vladimir
Yea, need some fixes about last \0
Oleksandr
yeah, u rm all spaces
lock
Oleksandr
but in real project this is bad solution
Vladimir
Just need to *str = 0 in the end
lock
lock
fgets doesn't wait for my input
lock
just closes
Vladimir
lock
🤣🤣
lock
Can anyone recomment me some practising exercises to understand those errors and to practise more things like this?
Vladimir
But it doen't matter - free will free it.
We don't even use heap memory, so what's wrong?
Oleksandr
and there is a case, when full string is a space_only, than first element will be '\0'
Oleksandr
that may be interpeted like ptr == NULL
Oleksandr
so, potentially, memory leak :3
Vladimir
Oleksandr
sorry, my fault)
Oleksandr
i understand already
Vladimir
👍
MᏫᎻᎯᎷᎷᎬᎠ
klimi
Otumian
fgets doesn't wait for my input
If you are taking another input, before it, check the size of the former (increase its size) or know the size of the former so that you won't enter more than that.. Perhaps
klimi