Null
This is like the first link in google: https://www.geeksforgeeks.org/c-program-to-read-contents-of-whole-file/
DaviChan
I need a less heavy solution
if you are using c++ you can make use of fstream and/or boost asio
Xitino :(
hiiiii
DaviChan
welcome :)
Xitino :(
could anybody tell me what's useful about passing a pointer to a function? What's the advantage of it instead of passing a variable using &?
DaviChan
could anybody tell me what's useful about passing a pointer to a function? What's the advantage of it instead of passing a variable using &?
a pointer is ootional, a reference is not. Also a reference is immutable by definition. Meaning it is pretty much " something * const"
DaviChan
a reference should not be nullable. This is how it is used in 99% of cases. Ofc. you can get a reference to be null, but not that easily
Xitino :(
i don't get it
DaviChan
yeah, you normally don't want that. I just meant it is theoretically possible, but should (im my view) never be used, because in my view the whole point of a reference is that its not optional like a pointer is.
DaviChan
for pointers you always had to check: if(pointer == nullptr) the advantage of reference is that it should never occur 😅
DaviChan
a limitation to that is ofc. that it cant easily be reassigned
Xitino :(
but i can't think about one particular reason why i should reassign a pointer in my code 😂
DaviChan
yeah, then use a reference
AlanCcE
Mar!o
Use assembly 🥴
assembly does not help here - file read is IO (disk) bound the fastest way to read a whole file: 1. open file stream 2. determine file size 3. allocate buffer with file size 4. read whole file at once into buffer without reallocating 5. done
不看女人
Is this a beginner group or an advanced group?
DaviChan
Use assembly 🥴
you still need the same syscalls 😅
Ziky
Is this a beginner group or an advanced group?
Depends what do you mean by advanced
Ziky
?
Be honest we often fail to understand question of newcomers 🤷‍♂
Karam
c#?
Emanuel
Heey guys so am new to C programming and I would like to configure my Visual studio for C programming could u help...?
Engineer
Jose
beginner
Nope, it's a mixed group. There are introductory questions, beginner, medium and advanced questions, and it's pretty!
Er Manu
If you consider a variable a named object and an object some Memory allocated with a type and a value, an instance of a class can be considered a variable ?
Ziky
well If i get it right then yes
Ziky
variable is basically struct with single member. And object is struct holding all nonstatic members plus pointer to virtual methods if class have any
dimazava
int i = 5; int *a = &i; auto b = a; why b is int*, but not int? Thought auto should kind of remove all the pointing, referencing and volatile properties from variable?
Anonymous
int i = 5; int *a = &i; auto b = a; why b is int*, but not int? Thought auto should kind of remove all the pointing, referencing and volatile properties from variable?
Where did you read that it dereferences a pointer? If it did, then this won't work: int a = 10; auto b = &a; If dereferencing were to happen, then b must be deduced as int and not int* and there would be no way to deduce b as an int*. auto does remove top level cv qualifiers. For ex: int a = 10; int* const b = &a; auto c = b; Here c will be int* and not int* const References are different in that references are treated as aliases rather than a different type. So int a = 10, &b = a; auto c = b; Here c will be int because b is treated as an alias for a.
Chat Boss
Sid Xid sent a code, it has been re-uploaded as a file
Olivia
what is the difference between int n* h; int n* &j; please explain in simply everyone thankyou :)
Dima
wtf is that syntax
Perush
Hey, What might be a good way to master Multidimensional arrays
Ziky
It is nothing more than few more pairs of brackets
sujith
can anyone help me regarding simple pipeline with instruction decoder in c/c++?
Osama
hello guys, what'up
Osama
I want to learn basic programming with c++ and then data structure and algorithm what is your advice?
Anonymous
In what case can we use public fields and where can't we use a setter/getter at the class field?
Osama
thanks guys
omar
Hello everyone, i learnt c++ basics and oop Now iam lost and don't know what to do after :(((((((((((((((
omar
Console projects u mean ?
Otumian
Console projects u mean ?
nah... Like data types, generic.. things like that.. Google c++ templates and see.. you'd like it
omar
By the way sorry for my bad English
klimi
Like what ?
c++ templates
IDCAN
What the difference between declaring local variable with struct operator or no? Example: struct curl_slist* slist1; curl_slist* slist2;
IDCAN
struct PERSON sister; // C style structure declaration PERSON brother; // C++ style structure declaration
IDCAN
https://learn.microsoft.com/en-us/cpp/cpp/struct-cpp?view=msvc-170
IDCAN
with struct it is longer
more allocation of memory?
Ziky
more allocation of memory?
no just longer line of code
IDCAN
i gotchu
IDCAN
thanks
Anonymous
What the difference between declaring local variable with struct operator or no? Example: struct curl_slist* slist1; curl_slist* slist2;
curl_slist is considered a tag name in C and not a type name. It becomes a type name when prefixed with struct keyword. In C++, it was decided to make the tag name a type name as well i.e. the C++ compiler implicitly adds something like typedef struct curl_slist curl_slist; So you can define variables of the struct without using the struct keyword in C++. In C, you have to manually do what the C++ compiler does automatically. There is a proposal to change this in C23.
布丁
btw are there any large C projects currently using C17?
Anonymous
btw are there any large C projects currently using C17?
C17 is not a major standard. It was just a TR and a minor bug fix. Most of the C projects in existence use C99. A few of them are in C11. C11 code is still not as portable as C99 code.
Ashkan
Hi guys. I have a little knowledge about Python and interested in C and C++. In Python there is a GUI library
Ashkan
Tkinter in Python. Is there any GUI library in C++ like python?
DaviChan
Tkinter in Python. Is there any GUI library in C++ like python?
i think tkinter can also be used in C++. C and also C++ have tons of UI libraries. They highly depend on your use case. For desktop applications i prefer to use wxwidgets
Ziky
Tkinter in Python. Is there any GUI library in C++ like python?
I would go with QT but it needs some tutorial as they bit "improved" c++ with their macros
AlanCcE
What do you guys think about GTK for UI?