|
That is EGAIN (you can look it up in errno.h and get the corresponding error message with strerror(3) - Linux manual page[^] ) and in most cases (as here) not an error. You are just calling read again too fast (the next character has not been received so far).
To avoid this you can set a timeout value. Then the read() will block until data are available or a timeout occured.
|
|
|
|
|
hi,
Which do I use ide for learn c ++ ?.
|
|
|
|
|
|
vi (vim perhaps) on a Linux box.
IDEs are for sissies.
|
|
|
|
|
CPallini wrote: IDEs are for sissies.
So are displays and WYSIWYG editors. An ASR-33 and ed are all you need!
(And yes, I'm old enough to have actually written programs that way. )
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
I am young enough to continue using vim .
|
|
|
|
|
Hello, there's a code.
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
int main()
{
char* x = (char*)calloc(sizeof(char),150);
char* p = x;
free(x);
x = NULL;
.....
return 0;
}
<pre>
Tell me how to get NULL under p when x is removed and set to NULL.
|
|
|
|
|
You have to set it explicitly, there is no garbage collector or reference counts in C. The two pointers have no connection, so when you free x , pointer p still points to the original block of memory. You must be very careful to manage dynamic memory properly in C, and even in C++.
|
|
|
|
|
You have not a pointer to pointer. As Richard correctly pointed out, you have two independent pointers to the same block of memory; you have to explicitely set p = NULL; .
With a pointer to pointer the scenario would change:
char* x = (char*)calloc(sizeof(char),150);
char** p = &x;
free(x);
x = NULL;
printf("%p\n", *p);
|
|
|
|
|
CPallini wrote: *p is NULL But p still holds the address of x.
|
|
|
|
|
Of course. That's the purpose of 'pointer to pointer' (I suppose).
|
|
|
|
|
I thought it was just to confuse people with small brains (me).
|
|
|
|
|
Nope, you are simply drunk because of English team success.
|
|
|
|
|
What success, they lost 2:1 to South Africa. They need someone like this guy[^] to lead and inspire.
|
|
|
|
|
OMG, Rugby!
|
|
|
|
|
Hello community,first post here and hoping I can get some help here to modify some C++ code.
So as the title said I would link some guidance to modify the source code for the dll compare plugin for Notepad++
Currently with the plugin as it is, comparing string gives the following result:
<oops cannot="" load="" picture!="">
Not very helpful to me as I do not where there the change is exactly.
What I would like it to do is something more like this:
<oops cannot="" load="" picture!="">
The source code for the plugin can be found here:
https://sourceforge.net/projects/npp-compare/
I had a look at the code in Visual Studio 2012 but I'm at a loss as to where to start making change... creating dlls is completely new to me! Any help would be much appreciated! (for starters how to load is picture to illustrate my intent )
|
|
|
|
|
|
Hello,
I need to create some control on title bar of title bar but thought it better to remove title bar and create our own custom title bar.
Please suggest how to create own title bar which could move the windows and add other options as well.
|
|
|
|
|
|
|
The most basic thing to do for your need is to handle the WM_NCHITTEST[^] message.
The LPARAM parameter gives you the mouse coordinates on your window and then you figure out if it is over your customized title bar and return HTCAPTION from the message handler.
You may also want to check when to return HTCLOSE , HTMAXBUTTON , HTMINBUTTON , HTSYSMENU etc.
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
|
|
|
|
|
I have recently been teaching myself C++, is it possible to go down the machine learning and artificial intelligence route effectively using this language? Or is C++ only good for game development in 2018 and onwards?
If that's the case what is a good language to go down the machine learning and artificial intelligence route?
|
|
|
|
|
As far as I know most of the ML libraries are available in R, Python, Spark etc. not sure if C++ is the correct route for ML.
|
|
|
|
|
|
C++ has been used (and is being used) for everything from low-level system APIs to ML. About the only thing I have not seen C++ used for is writing the kernel of an O/S (probably because it requires too much runtime library support).
Regarding Machine Learning libraries, what counts is not whether the library is written in C++, but whether it has an interface ("bindings") that is callable from C++. AFAIK, most low-level libraries (Android's NNAPI, Apple's Core ML, etc.) all have C++ bindings.
Many higher-level libraries (e.g. TensorFlow) call the lower-level libraries, and not all of these higher-level libraries have C++ bindings. Perhaps that is the cause of your confusion.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|