Code Snippet Index

C

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)
1

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)
C#

some help please.

//Code Written By S Barratt i would like my button display to - out put all the values of the arrayList. ------------------------------------------------------------------------------------------ i would very much like some information about key pressing so when the use presses the key... (Read More)
1

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)

ToolTip box

from Tkinter import * root = Tk() tipwindow = None # Creates a tooptip box for a widget. def createToolTip( widget, text ): def enter( event ): global tipwindow x = y = 0 (Read More)

Building argv from command line

Some time ago, I was writing a small command line interpreter, with the help of the standard module cmd which offers minimal support for such tasks, and I had the problem that this module doesn't have a function to parse a command line to produce a list argv which can be passed to optparse for... (Read More)
C++
-3

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)
-2

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)

Conversion to any base, with a fixed number of digits

Here's a function that manually converts an integer to any base between 2 and 36, the parameter list is: void toBase( int value, // Integer value to convert char *target, // Pointer to a large enough buffer int base, // Base (from 2 to 36) int fixedDigitCount // The minimum... (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)
PHP

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)

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)

Need Additional Code

The program will give the following output 55 45 36 28 21 15 10 6 (Read More)


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

©2003 - 2009 DaniWeb® LLC