Why use c strings in c++?
Is there any good reason to use C-strings in C++ nowadays? My textbook uses them in examples at some points, and I really feel like it would be easier just to use a std::string. ...
Is there any good reason to use C-strings in C++ nowadays? My textbook uses them in examples at some points, and I really feel like it would be easier just to use a std::string. ...
Is there a (cross-platform) way to get a C FILE* handle from a C++ std::fstream ? The reason I ask is because my C++ library accepts fstreams and in one particular function I'd like to use a C library that accepts a FILE*. ...
temp2, temp1 are pointers to some struct x: struct FunkyStruct x; struct FunkyStruct *temp1 = &x, *temp2 = &x; Now, after execution of following lines: temp2=temp1; temp1=temp1->nxt; ...Will temp2 and temp1 still point to the same memory location? If not, please explain why they would be different. ...
Where can I find a complete reference of the ncurses C API? ...
One thing I've really been meaning to get back into is C++ programming but I am not sure if I should go back to C++ (which I have some basic console programming knowledge) or should I look into C or Objective C? I'm looking at the long term as well as ease of coding such as good editors, compilers, etc as well as which would be the quick...
Some years ago I was on a panel that was interviewing candidates for a relatively senior embedded C programmer position. One of the standard questions that I asked was about optimisation techniques. I was quite surprised that some of the candidates didn't have answers. So, in the interests of putting together a list for posterity - wha...
I have been developing for about 8 years, and mainly come from a Web Background. I have extensively used the .Net Framework for development the last 5 odd years, including Web, Windows and Mobile. I have a good understanding of C# and VB, VB.Net I am thinking of learning a new language, and based on the interest I have understanding how...
I can print with printf as a hex or octal number. Is there a format tag to print as binary, or arbitrary base? I am running gcc. printf("%d %x %o\n", 10, 10, 10); //prints "10 A 12\n" print("%b\n", 10); // prints "%b\n" ...
I'm having a hard time understanding and therefore managing arrays and indexes manually in C. These are my two classic approaches but they doesn't seem to work as they keep looping when the condition is reached: #include<stdio.h> #define MAX 255 int main(){ int arr[MAX]={0}; int idx=0; /* Approach #1 */ printf("Ente...
Does anyone know of an MD5/SHA1/etc routine that is easily used with GLib (i.e. you can give it a GIOChannel, etc)? ...
The code currently does this and the fgetpos does handle files larger than 4GB but the seek returns an error, so any idea how to seek to the end of a file >4GB? fpos_t currentpos; sok=fseek(fp,0,SEEK_END); assert(sok==0,"Seek error!"); fgetpos(fp,¤tpos); m_filesize=currentpos; ...
I'm seeking a library, technique or advice on how to read an EAN-13 barcode from an image (including ISBN,and ISSN encodings). The image would come from a mobile phone or webcam, so resolution may be quite poor and not well aligned. I'm specifically interested in something that could be used from ruby on rails, but answers for other lan...
I'm building a project from command line , using WinCE platform builder , and I need RTTI to be enabled , so that my project works correctly . I tried setting the option RTTI="YES" in the sources and in the makefile of each dir , and I also tried to add it at the end of CDEFINES , but when I try to build the project , I get the D9025 w...
How do I get the current size of a matrix stack (GL_MODELVIEW, GL_PROJECTION, GL_TEXTURE) in OpenGL? I want this so that I can do some error checking to ensure that in certain parts of the code I can check that the matrix stacks have been left in the original condition. ...
What is the best unicode library for C? Where "best" is defined by cross-platform support, compiler independence, and reasonable performance across a the most common languages in use. ...
Does anyone know how to read from a promiscuous (or sniffing) device in C? I know that you need to have root access to do it, but I was wondering if anyone knew what functions were necessary to do this (normal sockets wouldn't seem to make sense here)? I want to write a real-time analysis tool for wireless traffic. ...
Has anyone had success automating testing directly on embedded hardware? Specifically, I am thinking of automating a battery of unit tests for hardware layer modules. We need to have greater confidence in our hardware layer code. A lot of our projects use interrupt driven timers, ADCs, serial io, serial SPI devices (flash memory) etc.. ...
I've googled around and found most people advocating the use of kmalloc, as you're guaranteed to get contiguous physical blocks of memory. However, it also seems as though kmalloc can fail if a contiguous physical block that you want can't be found. What are the advantages of having a contiguous block of memory? Specifically, why would I...
I know C is not a very popular language but I need it for school. I'm fine working on Linux using gcc as my C compiler but would like a Windows solution. Any ideas? I've looked at Dev-C++ from Bloodshed but looking for more options. ...
When writing an app that one wants to have compile on mac, linux and windows, what is the best way of managing the different libraries that will need to be included on the various operating systems. For example, using the glut opengl toolkit requires different includes on each operating system. ...