C and C++

Home » C and C++ (344)

Fetch a url using InternetOpenUrl API
This article has two parts. First introduction to WinInet APIs required to use InternetOpenUrl and second a sample code. Sample code is a dialog base VC++/MFC application which is attached as Url.zip.

Before talking about InternetOpenUrl, we need to look into InternetOpen API.

Rational Test RealTime Users Guide
It contains 4 main parts: Runtime Analysis - Satic Metrics, Memory Profiling, Performance Profiling, Tracing; Automated Testing - Component Testing with C and Java; Graphical User Interface - GUI Philosophy, Configuration and Settings; Command Line Interface - Runtime analysis and testing for C and Java.

stdiostream
This is a stdiobuf implementation of my own design.
The purpose is to allow you to wrap a C stdio FILE* with a std::iostream.

Printer Stream
Free C++ Tutorial for you. A little while ago, someone made a post like this:
ostream printer;
printer << "Some text" << endl;
and wondered why it didn't print.

Bison Tracking
Why the Fortran would anyone want to do this? (Pardon my language). It's because C++ parsers that you make yourself:
-Produce more human friendly code For starters, the files that Flex and Bison output can be very hard to understand, even if they do have some decent comments. This can make them hard to integrate into other programs. However, since you wrote most of this and hopefully read this article, you have an idea of what's going on.
They also have a tendency of being large.

QxOrm : Persistence (ORM), Serialization, Reflection
QxOrm has been tested on Windows (Visual C++ 2008 and 2010) and Linux (GCC 4.4.1).
QxOrm is based on a simple and non intrusive 'setting function' (that can be compared with Hibernate xml mapping file).
A quick sample (and a tutorial) is available on this web site (only in french, an english translation is in progress...)

Distinguish between pointers and references
Pointers and references look different enough (pointers use the * and -> operators, references use .), but they seem to do similar things. Both pointers and references let you refer to other objects indirectly. How, then, do you decide when to use one and not the other?

generate any possible password in lowercase alpha
generate any possible combination of words to find the passwords of any length in lowercase alphabits (a to z), this piece of code prints more than 500 combinations (if there are more than 500) per second on intel core i3,i5,i7 processor family...
this code can be modified to make it more faster only you have to do is to make a file instead of printing the words on the screen about more than 50,000 combinations per second...

use new to allocate a structure array
I searched the internet front and back looking for the answer to this problem. "Do programming exercise 4, but use new to allocate a structure instead of declaring a structure variable. Also, have the program request the pizza diameter before it requests the pizza company name."
I have a minor in computer science but since it has been a while since I have done any programing I wanted to put myself to the test and reinforce what I know and see if I can learn more on my own. Anyway I ran into this problem and could not find a good example to emulate so after many attempts I figured it out and I want to share my code with anyone who may run into this problem in the future or so that I can find it if I need to in the future. I used MS visual studios so adjust to your compiler.

Cleaner code
The reason for me to write this article is the fact that many people don't seem to know (or care) about code readability. Readability is the base for portability, re-usability and understandability (!).

The Console is a Terrible Medium for Games
In this article I use SFML in the example (get it at http://www.sfml-dev.org ). I like SFML because I find it to be particularly beginner friendly, but also very fast, well documented, cross platform, has an active userbase, and is actively being developed. However it is not your only option. Other libs are available, such as Allegro or SDL.

Debugging Your Program
I feel that this is a topic that needs to be covered in detail. As it is, debugging is an incredibly important part of programming. If you run upon errors, you need to know how to find the issue, and resolve it. If you’re missing a semi-colon, you shouldn’t have to make a post to figure that out.

Why we are a bunch of tough lovers.
This is an article about our refusal to answer homework questions and solve homework problems.

Use of void pointers (void*) and templates
In C, the use of void pointers can be extremely useful. It can be used as a universally generic pointer that can point to any type. The limitation to this is that you must know the type that the void pointer was casted from in order to obtain data from it (which usually isn't that bad). Here's example using a simple list struct.

Powerful Console in Windows/VC++ (Color, Cursor, ...)
Powerful Console in Windows/VC++ (Color, Cursor, ...)

Simple XOR encryption
everything on a computer is stored as binary data, in the form of bytes (8 bits, or individual 1's or 0's)
Binary data can easily be "encrypted" with a "key" based on a little boolean operation called an xor, or exclusive or.
when we xor a single bit (a 1 or 0) with another bit:
if 1 bit is true, and 1 bit is false, it returns true, otherwise it returns false.

Moving along lines
Many people know what a line is, and many more can draw them using slope. But I've noticed that when trying to draw a line using only the origin and end points, people stumble and fall.

Searching And Sorting
I couldn't really find a good example of the various searching and sorting algorithms out there so i figured i would post one i did for an assignment.
The number of comparisons done may not be done quite right but it definitely gives you the idea of which ones are more efficient.

Linked List Template and Binary Search Tree
I am posting this because after all my research I could not find a good example of both a templatized linked list and binary search tree. These are what I was able to come up with hope this helps anyone looking for something like this. The template linked list is very useful.

Rounding Algorithms - Discussion
On a slow but regular basis I get questions and commentary about the Article I posted a while ago:

Home » C and C++ (344)