C Compatibility Between Integers and Characters
How does C handle converting between integers and characters? Say you've declared an integer variable and ask the user for a number but they input a string instead. What would happen? ...
How does C handle converting between integers and characters? Say you've declared an integer variable and ask the user for a number but they input a string instead. What would happen? ...
I've googled around for a while trying to find a good libnet tutorial but most of them appear to be out of date or lacking on good code examples. What do you recommend for learning libnet? I'm also having problems compiling programs using the libnet headers; what's the flag(s) needed for this? ...
I'm looking into a mechanism for serialize data to be passed over a socket or shared-memory in a language-independent mechanism. I'm reluctant to use XML since this data is going to be very structured, and encoding/decoding speed is vital. Having a good C API that's liberally licensed is important, but ideally there should be support f...
I've tried a couple of times to teach myself to program in C using books, but haven't had the patience to progress through all the mundane examples. I have experience of programming in Java, and I'm a good PHP developer, so I find Hello World and generic programs-to-read-from-STDIN aren't really very informative. I imagine that a better...
What is the best way to get started with programming things outside of your computer? I don't mean mainstream things like cell phones with APIs. Please assume working knowledge of C/C++ ...
I was reading this answer previously and it got me interested in purchasing a Nintendo DS Lite for learning to program embedded devices. Before I go out and splurge on a DS I had a few questions: Are there any restrictions on what you can program? The post I indicated earlier seemed to say there weren't, but clarification would be nic...
Very simply put, I have the following code snippet: FILE* test = fopen("C:\\core.u", "w"); printf("Filepointer at: %d\n", ftell(test)); fwrite(data, size, 1, test); printf("Written: %d bytes.\n", size); fseek(test, 0, SEEK_END); printf("Filepointer is now at %d.\n", ftell(test)); fclose(test); and it outputs: Filepointer at: 0 Writte...
I am taking a class in C++ programming and the professor told us that there is no need to learn C because C++ contains everything in C plus object-oriented features. However, some others have told me that this is not necessarily true. Can anyone shed some light on this? ...
What would be the quickest way to construct a python binding to a C or C++ library? (using windows if this matters) ...
Is there a wchar_t version of exec[lv][pe]* (i.e. an exec that uses wchar_t as path and wchar_t as arguments)? In Windows, I can just do CreateProcessW(process, cmdline), but in *nix, I'm stuck (i.e. no pure POSIX equivalent). I'm trying to add UTF-16 support to my program (an autorun). ...
Suppose we have a vector/array in C++ and we wish to count which of these N elements has maximum repetitive occurrences and output the highest count. Which algorithm is best suited for this job. example: int a = { 2, 456, 34, 3456, 2, 435, 2, 456, 2} the output is 4 because 2 occurs 4 times. That is the maximum number of times 2 occu...
From time to time I read that Fortran is or can be faster then C for heavy calculations. Is that really true? I must admit that I hardly know Fortran, but the Fortran code I have seen so far did not show that the language has features that C doesn't have. If it is true, please tell me why. Please don't tell me what languages or libs are...
I have a problem with scandir(): The manpage contains this as prototype: int scandir(const char *dir, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); Therefore I have this: static inline int RubyCompare(const struct dirent **a, const struct dirent ...
I have a couple of header files, which boil down to: tree.h: #include "element.h" typedef struct tree_ { struct *tree_ first_child; struct *tree_ next_sibling; int tag; element *obj; .... } tree; element.h: #include "tree.h" typedef struct element_ { tree *tree_parent; char *name; ... } element; The ...
I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would help. int ret; ret = execl ("/bin/ls", "ls", "-1", (char *...
Is the D language a credible alternative to Java and C++? What will it take to become a credible alternative? Should I bother learning it? Does it deserve evangelizing? The main reason I ask is that with the new c++ standard (c++0x) almost here, its clear to me that the language has gone well past the point of no return with respect to ...
I'm using C and sometimes i have to handle paths like C:\Whatever, C:\Whatever\ or C:\Whatever\Somefile Is there a way to check if a given path is a directory or a given path is a file? :O ...
I'm writing some semi-portable code and want to be able to detect when I'm compiling for iPhone. So I want something like #ifdef IPHONE_SDK.... Presumably xCode defines something, but I can't see anything under project properties, and google isn't much help. ...
Here's what I am trying to do: typedef enum { ONE, TWO, THREE } Numbers; I am trying to write a function that would do a switch case similar to the following: char num_str[10]; int process_numbers_str(Numbers num) { switch(num) { case ONE: case TWO: case THREE: { strcpy(num_str, num); //some way to get the ...
Hi I currently have heavily multithreaded server application, and I'm shopping around for a good multithreaded memory allocator. So far I'm torn between: -Sun's umem -Google's tcmalloc -Intel's threading building blocks allocator -Emery Berger's hoard From what I've found hoard might be the fastest, but I hadn't heard of it before ...