How does the ternary operator work?
Please demonstrate how the ternary operator works with a regular if/else block. Example: Boolean isValueBig = value > 100 ? true : false; Exact Duplicate: How do I use the ternary operator? ...
Please demonstrate how the ternary operator works with a regular if/else block. Example: Boolean isValueBig = value > 100 ? true : false; Exact Duplicate: How do I use the ternary operator? ...
I am looking for a FFT library with a license that allow me to include it in a commercial C++ software. Free would be nice. (Intel IPPS is 199$ per head, which is a bit expensive for the number of developper that will be compiling it.) Anybody has good experience with such a FFT library? I found this page, which list a lot of librari...
Ok, so I'm trying to get some UDP code working and I'm barely green when it comes to network programming using C. I'm using the sample file from here Basically I'm just listening for incoming UDP packets on a given port and then I want to send some data back the same way. Below is the relevant part. At this point the socket is set up a...
I've been writing Java professionally for the last 5 years. Recently, I've had to dig into JNI a bit to call some Windows specific functions. This experience has highlighted my poor command of the C (or C++ for that matter) language. My only introduction to C was a brief "dummies" book that I read in high school 11 years ago. I know ...
Hi, everyone! My major is not computing, but I really love computer tech, and I want to learn C. In college, I have learnt a little bit of C and C#, and used C# develop a small piece of software. Can you recommend any good books, websites, blogs, advice, tools, etc. to me? Thank you very much! ...
am trying to create a GUI for a c code written in LINUX. this code basically connects two systems,opens the serial port,writes data from one system to the other via the port.how do i go about this? the development tools present with me are Qt designer version 3.3.5 and K Develop,which one should I use.and how to go about it? am a total b...
I'm summing two negative floats: char * lhs = "-2234.6016114467412141"; char * rhs = "-4939600281397002.2812"; According to Perl, using bignum and Math::BigFloat, the answer is -4939600281399236.8828114467412141 However, according to GMP, using the code below, the answer is -4939600281399236.88281 Where have I gone wrong? What h...
Is there any materials about how to use #include crorrectly? I didn't find any c/c++ text book that explain this usage in details. In formal project, I always get confused in dealing with it. Thanks for your help. ...
I'm porting a library from Windows to *NIX (currently OSX), does anyone now what function can I use instead of Microsoft's QueryPerformanceCounter and QueryPerformanceFrequency? ...
Hi, I have my SNMP Extension Agent DLL that is called by the Windows SNMP Service (snmp.exe) everytime i do an snmpwalk (another console application) .I want to step into my DLL code that is called from the above Windows Service. How do i go about doing that? Thanks Som ...
I need to perform 9 different operations on a coordinate, depending on the position of the coordinate. I have a function that returns the coordinates of a position around the given coordinate (down, up, left, right or diagonals). The 9 different operations are the different possible 'types' of coordinate; if I'm dealing with coordinate (...
I'm just starting on the road the learning C, and ran into some difficulty: The code listed below is giving me the following error: Attaching to program: `/workfolder/cocoa/c_stuff/bookshelf/build/Debug/bookshelf', process 1674. Cannot access memory at address 0xa0df194 Cannot access memory at address 0xa0df194 // code start #define ...
I want to write a function that returns the nearest upper power of 2 number. For example if my input is 789, the output should be 1024. Is there any way of achieving this without using any loops but just using some bitwise operators? ...
I am using Berkeley sockets (both: Internet domain and Unix domain) and I was wondering if the server can use the same sockets for reading the request and writing a response to the client. Or should the client create an other socket to wait for the replay and the server connect to it after processing the message received. By the way, I ...
If you have a position where C++ experience is essential, would you consider someone who has little C++ experience but is experienced in both C and Java? ...
Is writing to stdout using printf thread-safe on Linux? What about using the lower-level write command? ...
If for example I should not use standard library functions like printf, putchar then how can I print a character to the screen easily. Is there any easy way of doing it. I dont know much about system calls and if I have to use them then how? So can any one advice an easy way of printing a character without using library functions?? Than...
I have a function that takes pointer to pointer to struct. struct ABC; void func(ABC ** ptr); //func is provided by someone else and i don't know about the implementation. { } Now, i have following code. ABC xyz[2]; ABC * ptr = xyz; ABC **dptr1 = &ptr; //pointer to ponter ABC ** dptr2 = (ABC **)malloc(2*sizeof(struct abc*))...
Suppose I have an open file. How can I detect when the file is changed by another program in the background. Some text editors can detect and update the open file if it is changed by another process. I'm specifically asking for this with C under Linux(this seems to be OS dependent). ...
I have an application that monitors a high-speed communication link and writes logs to a file (via standard C file IO). The response time to messages that arrive on the link is important, so I knowingly don't fflush the file at each message, because this slows down my response time. However, in some circumstances my application is term...