Code Snippet Index

Wer wei?, wo zum Download XRumer 5,0 Palladium?

Wer wei?, wo zum Download XRumer 5,0 Palladium? Hilfe, bitte. Alle empfehlen dieses Programm, um effektiv werben im Internet, das ist das beste Programm! (Read More)
C
1

Linked List

This is just a linked list program for those who need help understanding the fundamentals. Put comments if you find some bugs. The program is about maintaining a student database (their roll number and their age) I've used Turbo C++ 4.5 as the compiler :icon_cool: (Read More)
1

fseeko64() and ftello64() for deal with large files (eg. file dimension)

fseek() and ftell() work only for files < 2,147,483,647 bytes fseeko64() and ftello64() from <stdio.h> can deal with files up to 18,446,744,073,709,552,000 bytes the printf format for unsigned long long val is %I64d eg. Obtaining the file dimension (this code was tested with GNU GCC... (Read More)

Changing the contents of a file

I'm working on a program to score a bowling game. Right now, my terminal says that my program has a seg fault, but I can't tell where. Any other insight on how to help my program do what it's supposed to do would be helpful. I'm still not sure how to weed out all the characters, although I think... (Read More)

List Windows Logical Drive Letters

This demonstrates how to get a list of your computer's logical drive letters under the MS-Windows operating system. (Read More)
-1

errno - perror vs fprintf + strerror

Hi! From the manpages I know, that perror evaluates the errno. So using perror and fprintf + strerror, as coded in my example below, should result in the same error messages, but they do not. The execution of the program leads to the following result: bash> ./errno_test blub fopen()... (Read More)
1

can any one help me about calculating the exact execution time of processor

hi, Can any one help me about clock problem..i need to calculate the exact execution time of algorithm using the processor clock speed not the wall clock time..i am getting zero by using the clock_t function in time.h.also how can i calculate the exact processor speed execution of... (Read More)

replace a substring by a new substring.

need to replace all occurences if substring by new string. below code replace first occurence but not other substrings present in input string. (Read More)

Prime Factorization

A program which displays the prime factors of a given number, all the 'hard' work is done by the factorize() function: /* Find out the prime factors * of a given number and print * them on the screen */ void factorize(int n) { int d = 2; if(n < 2) return; (Read More)
-1

help with c program

HI the prgram below request a user to enter 3 character id number and interger age. a function must be used that tells the user how many years to retirement. i must pass the age and print a message in the function. retirement age is 65 for persons over 45 and 70 for all other persons. the... (Read More)

need help with a simple C program

The programming assignment is to read a text file, extract the words from it, and save them in a 2D array that contains the word and the number of occurrences of that word. For example, if a text file contains the words "first" "second" "third" "second", the array should contain - first 1 second... (Read More)
-1

Linked list coding for CPU scheduling algorithms help with pointers

struct PCB* handleProcessArrival_PP(struct PCB *processhead,struct PCB *processtail,struct PCB *currProcess,struct PCB *newProcess,int currTime){ if(currProcess==NULL){ newProcess->executionStartTime = currTime; newProcess->executionEndTime =... (Read More)

Windows Event Handler in MASM

This procedure dispatches application defined event handlers and alternately executes default process for both standard or sub/super classed windows. Map is defined as follows. In most cases I define this table in .data, but in can be in .const also. I choose writeable memory as application... (Read More)

a86 Palindrome

Hey guys.. need some help with this; I'm pulling my hair out.. i've trawled these boards but can't find anything that answers my question. I, like many others before me (so it seems!) am trying to create a program to check for a palindrome.. this is what I have so far. In the compare part..... (Read More)

A context to change current working directory.

This snippet defines a context to execute a block of statements in a different working directory (with the help of the with statement). After the block is exited, the initial working directory is restored, even if an exception has occurred in the with block. (Read More)

Connect 4 - make_board

Hi Folks the game runs. jippie, but i have a small problem i cant get the board to get drawn from left to right, its drawn from upwards to downwards hope anyone can help me Sincerly elomanias (Read More)

Getting an input without hitting enter

!USING PYTHON 3.1! USING WINDOWS I never thought it could be so simple. However I should have clarified that it's a 1 character input. But the general idea is the same. Someone suggested that I explain what is going on better, so I'm going to do that. The function 'getch()' waits for a... (Read More)
2

Really Simple PlugIns Loader - Import all modules in a folder in one swoop

PlugIns in their simplest form can be just python modules that are dropped into some designated directory and dynamically loaded by the main application. This snippet can be used to do just that. Usage To load plugin modules: >>> plugins = importPluginModulesIn('mypackage') >>> plugins... (Read More)
1

how to use getpass in python

#! /usr/bin/env python #filename:pwd.py # development environment:python2.51 import getpass usr=getpass.getuser() while True: (Read More)
2

Singletonize any class

This is one simple way to emulate a singleton class on behalf of a normal class. (A singleton class is a class with at most one instance.) The implementation does not emulate a class 100% (for example it lacks the special attributes lile __dict__ or __bases__), but it should be absolutely... (Read More)

Sorting complicated objects (Python)

This code snippet shows you how to sort more complicated objects like a list of lists (or tuples) by selecting an index of the item to sort by. (Read More)

JS Date-parser

This is a simple code-snippet that can be used to parse dates with javascript. It's setup to use European dates (dd.mm.yyyy | dd/mm/yyyy | dd,mm,yyyy), but it can easily be setup to use american dates as well (mm/dd/yyyy etc), to do so simply replace "$1" with "$2" and "$2" with "$1". No... (Read More)
C++
2

musician needs basic help

Hello i am a musician and not a programmer. i assume this is completely obvious to you by now. do listen to my music if you please. something to do while you read my long enquiry. samantha.mp3 I am attempting my first c++ program to create a program for a midi control device..... a... (Read More)
4

Adding two Big string numeric integer

The function adds two large numeric string together, like "12345667" + "12345678" = ? It does not have complete error checking, I'll leave that up to you. It should work but I am prone to bugs, so do advise if bugs are found. Included are also helper function that helps us add the large... (Read More)
1

How to access map outside the class

#ifndef _READFILE_H_ #define _READFILE_H_ #include<string> #include<vector> #include<map> using namespace std; class Readfile{ (Read More)
2

reverse queue

I am given the class definition of stack and queue classes where I have to write a templated function called reverseQueue(?) that takes a pointer to queue as a parameter and uses stack object to reverse the given queue. The function call to reverseQueue should reverse the data of the passed as a... (Read More)
1

Binary Tree Question

Can someone help me with this problem here about Binary Trees. I was given this code... and I am required to write a function void count_nodes(?) to determine the total number of nodes in a Binary Tree. (Read More)
-1

Need help with fraction calculator

I have add the two functions the add and subtract I have to now add the multiply and divsion functions can someone help (Read More)

Reference Variable

What will be the value of "++n" in the above code? Pls help.. (Read More)
1

fstream not working

Hi, I tried to direct the output from a thread into a log file using fstream, but it dosent seem to work. If I use ostream then it works fine. Can you please let me know why fstream is not working. Thanks in advance (Read More)
C#

Very simple console barchart

Well, I don't think I can make this any simpler. I hope newbies in the C# language can learn from it. (Read More)
1

Bouncing ball

Wanted to let two forms work together. One form would be the input form and the main form would consume this data. I managed to succeed with the help of a few of my friends here at daniweb., who helped me setup a static form. Just posted a bit of the most relevant code here, the rest of the... (Read More)

SQL Insert India 'State'

Table CREATE TABLE `state` ( `StateID` INT(11) NOT NULL AUTO_INCREMENT, `CountryID` INT(11) NOT NULL, ... (Read More)
PHP

Javascript not working in PHP class file

I am in the process of learning PHP with JS and Ajax and have the foll. problems. I have created a class to generate master data entry screens. (1) Javascript code that works when I run master.class.php independently does not work when I run users.php. I came across this problem while trying to... (Read More)

Export CSV TO Mysql and Import to CSV from MYsql in PHP

Export CSV TO Mysql and Import to CSV from MYsql in PHP (Read More)

Keypress event

Dear Sir, I am completely new to VB.NET but i worked in VB6.0 very well. My problem in VB.net is that i need a code through which i can print a message box which will show what key is pressed like control , alt,1,.,2 etc. Please help me. or other way i want to deactivate... (Read More)

from where to i start software projects

hi, i have just started programming.i have very good knowledge of c&c++.so,i have to do some software projects.but,atually which projects? please give me just simple topics for my project.thanks (Read More)

can any one tell me how to open image of .CAL extension or .TIFF extension in vb6

Type BITMAPFILEHEADER bfType As Integer bfsize As Long bfReserved1 As Integer bfReserved2 As Integer bfoffbits As Long End Type Type BMPInfoHeader (Read More)

hdd physial id

i run vb6.0 code in xp for getting hdd physical id and it run ok. but when i run same programme in vista it does not display any hdd physical id. please solve the problem (Read More)

Need help writing a perl script to parse multiple files

I'm new to perl and I'm writing a script to parse multiple Gaussian03 output files and extract certain pieces of data from them. Ideally the script needs to print out the name of each file, look for (the last) SCF Energy, the Zero-point Energy and check if the job has converged (i.e. in the... (Read More)


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC