User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 427,940 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,620 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Code Snippets By: Dave Sinkula
How might I write an implementation in C of the standard library function strcpy? Here's how I might. (View Snippet)
How might I write an implementation in C of the standard library function strstr? Here's how I might. What if I need it to be case-insensitive? (View Snippet)
How might I write an implementation in C a case-insensitive version of the standard library function strstr? Here's how I might. But I need it to be case-sensitive? (View Snippet)
How might I write an implementation in C of the standard library function strstr? Here's how I might. (View Snippet)
Many times strtok is recommended for parsing a string; I don't care for strtok. Why? It modifies the incoming string, so it cannot be used with string literals or other constant strings. The identity of the delimiting character is lost. It uses a static buffer while parsing, so it's not... (View Snippet)
Never use the function gets. Why? It is unsafe. Since the maximum string size cannot be specified, it is always susceptible to buffer overflow. This snippet shows one way to do a safe version of gets. It reads characters from the stdin into a string up to the specified size and discards the... (View Snippet)
Obtaining user input can be done in many surprisingly different ways. This code is somewhere in the middle: safer than gets(text) or scanf("%s", text), but not bulletproof. It is meant to be a simple but relatively safe demonstration. The function mygetline reads user input from the stdin into a... (View Snippet)
Obtaining user input can be done in many surprisingly different ways. This code is somewhere in the middle: safer than scanf("%d", &n), but not bulletproof. It is meant to be a simple but relatively safe demonstration. The function mygeti reads user input from the stdin into a string using fgets.... (View Snippet)
This snippet shows how to use the functions time, localtime, and strftimetime to pick off only the time parts for display. (View Snippet)
Some issues with date/time calculations. (View Snippet)
All times are GMT -4. The time now is 6:46 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC