Oleksandr
-p flag force create nested dirs
Anonymous
Maybe my computer is going bonkers so I will buy a new one
Vladimir
-p flag force create nested dirs
And not produce existing errors like man said
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
@k_vark будет кого матюкать по-русски :DD
забанить бы тебя за русский
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)
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>
lock
But what's the error
Oleksandr
what are u realy want, when init int var by pointer?
Vladimir
I think the error is in the removeSpaces() function
I think you should delete this function and rewrite it from scratch.
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
I think you should delete this function and rewrite it from scratch.
actually, here's the right answer)))) delete that shit
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
Just a test to check if the replacement is working
it doesn't work, because "A" and 'A' are whole diff things
Oleksandr
that bot are scaring me
Vladimir
To test I'm using as argv[1] ABABABAAABAA to check if A's are converted to B's
Why do you test replacement if you want to delete spaces? I would just create second array where to copy non-space symbols from the initial.
lock
Ok, I'll try to do that
lock
thanks all of you for helping!
Vladimir
useless syscall using
But it's simple
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
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
Oleksandr
but in real project this is bad solution
lock
but in real project this is bad solution
okay... for the moment I'm right now practising to understand how to work with pointers and that stuff
Vladimir
Just need to *str = 0 in the end
lock
Just need to *str = 0 in the end
all right I'll change the loop to fix the \0
lock
fgets doesn't wait for my input
lock
just closes
Oleksandr
Just need to *str = 0 in the end
he set 0, but probably lose real length of allocated memory, which \0 was indicated by
Vladimir
adnd why it's that not working
idk, think lots of errors
lock
🤣🤣
lock
Can anyone recomment me some practising exercises to understand those errors and to practise more things like this?
Vladimir
he set 0, but probably lose real length of allocated memory, which \0 was indicated by
If he removes spaces from string in the same string it's natural allocated space in the end will be lost.
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
Oleksandr
sorry, my fault)
Vladimir
that may be interpeted like ptr == NULL
We don't change pointers, how can it become NULL?
Oleksandr
i understand already
Vladimir
👍
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