Anonymous
I know some but they are in spanish
Ah dang it, I don't speak spanish. Thanks anyways though
Võ Lê Huy
I have read library "tgbot C++", it create bot and invite user to chat. I finding library control my account telegram, what am i doing (chat with friend, send photo for my friend .....) , can any one share me?
Henry
You mean a library sends telemetry?
Võ Lê Huy
I mean a library to automation my telegram account
@unchanted
how to take ascii value form 'char *' i wrote " ptr[i][j] != '\0' " where i got an error of '!=': no conversation from 'int' to 'char *'
Artöm
You sure you wrote '\0' and not "\0"?
@unchanted
yes sure
@unchanted
i think i got issue
@unchanted
actually I was using one extra pointer while calling the pointer function and there was no need...
Anonymous
Can someone explain me what is the difference between machine-level overflow and type-level overflow? And yes, I looked for it. But I didn't find anything
Anonymous
There is no official Ada forum in telegram.
Anonymous
It is related to maximum and minimum value of a type. But I don't understand the difference
Arseny
There is no such notion in C/C++ AFAIK.
Arseny
Ada...
Rules prohibit another languages, aren't they?
Anonymous
I didn't talked about it such as an Ada specific question. I talked about it as a "Programming specific question"
^^^
There is no official Ada forum in telegram.
hi 😊 there is no forum but group in tele
Anonymous
Rules prohibit another languages, aren't they?
Because I thought it was a concept implented in all programming lamguage (Even C/C++)
Anonymous
hi 😊 there is no forum but group in tele
Thanks for the correction 😁
Arseny
Because I thought it was a concept implented in all programming lamguage (Even C/C++)
In C++ unsigned overflow is well defined operation - it just "wraps around". Signed overflow is UB (undefined behaviour) and normally should be avoided.
Anonymous
Thank you
Anonymous
U're welcome
PO
Hi
PO
File.pdf
PO
someone can tell me how can I get .pdf of entered ?
Dima
you want an extension?
Anonymous
Or a free pdf?
Dima
lol
PO
you want an extension?
In my program I have to check the extension file
Alex
In my program I have to check the extension file
cut symbols from the end until period
Dima
In my program I have to check the extension file
one naive C way would look like: void getExtension(char* extension, int maxLength, const char* source) { assert(maxLength > 0); for (int i = strlen(source) - 1; i >= 0; --i) { if (source[i] == '.') { ++i; ::strncpy(extension, source + i, maxLength); return; } } extension[0] = '\0'; }
Dima
but yeah would look better using c++
Dima
THAT WAS FAST
yeah copied from my sources lol
PO
yeah copied from my sources lol
My project for university is in C
Dima
but safe though.
vinícius*
In my program I have to check the extension file
if you just want to check (and not return it), you can use strstr
Anonymous
... no comment XD
vinícius*
PO
strrchr is good too
What is the different between strchr and your native way?!
Dima
What is the different between strchr and your native way?!
I said naive, I mean it’s very straightforward
PO
I said naive, I mean it’s very straightforward
Ok sorry, what is the different and the best way?!
Anonymous
Ok sorry, what is the different and the best way?!
You mean more appropriate depending on the situation?
PO
You mean more appropriate depending on the situation?
Yes, I have to check entered extension from command line and output extension entred by user from command line
PO
I said naive, I mean it’s very straightforward
Can I ask how many years do you have experience in C programing?!
vinícius*
Yes, I have to check entered extension from command line and output extension entred by user from command line
you can do something like this: if (strstr(filename, ".c")) { // do ".c"-relevant code } else if (strstr(filename, ".php")) { // warn the user to please NOT use .php } else if (strstr(filename, ".tex")) { // convert to .pdf }
PO
Ok thank you
Uge
Hi , I'm try to use glnagd language server with vim and coc-clangd, it works, but if I include some library like SDL.h it don recognize and give me an error
Uge
[clang: pp_file_not_found]
vinícius*
Cengizhan
But your code is not to correct one, wrong algorithm.
vinícius*
aight
vinícius*
reverse the string and strcmp the first elems
vinícius*
happy?
Cengizhan
Still wrong one, not happy.
vinícius*
why wouldn't it be?
vinícius*
if (!strncmp(reverse_filename, "c.", 2)) { // yayyy, got the .c file with a dumb-ass non-gcc compliant name }
Cengizhan
strcmp is not correct one, strncmp might be okay but still reversing is expensive.
vinícius*
write a more performant version
vinícius*
you can use strrchr (O(n)) to find the last dot, and then compare the rest of the string
vinícius*
same complexity.
Cengizhan
Same complexity about time not memory.
vinícius*
in fact, mine is more performant when doing more checks
vinícius*
there's a single-time cost of reversing the strings, but then the rest will be small strncmp comparisons
Cengizhan
Perfect!
vinícius*
strrchr everytime would be slower
Cengizhan
I do not say anything about my work, how do you know that doing more checks worse than yours?