15,550 Topics

Member Avatar for
Member Avatar for Kurt Kubing

I've been looking for the thread re swapping values of two string pointers but I couldn't findit and I don't know if it has already been solved. Assuming it's still on the lines waiting, I think I've got the simple code to solve it: [code=c]#include <windows.h> void swap(LPCTSTR*,LPCTSTR*); int WINAPI …

Member Avatar for Dream2code
0
126
Member Avatar for cheqmate

Hi, I have two issues that I am hoping to get assistance with. To begin with, the code snippee below is designed to read a line from a file, then place a subset of the line in another array. This works correctly when I place a number in arg 2 …

Member Avatar for Dream2code
0
90
Member Avatar for waqarafridi

Hi All Can some body tell me how to compare two strings that has spaces, I have inputed one string using scanf() and the other using gets(), both of the strings are array of characters.

Member Avatar for Dream2code
0
2K
Member Avatar for rcbhat

[code=C] #include<stdio.h> int array[]={1,2,3,4,5,6,7,8}; #define SIZE (sizeof(array)/sizeof(int)) int main() { printf("%d",SIZE); if(-1<=SIZE) printf("1"); else printf("2"); return 0; } [/code] how is SIZE casted in this example? Because the compiler believes -1 > SIZE (which is 8). Is this because it was treated as unsigned char and -1 looped around to …

Member Avatar for kvprajapati
0
96
Member Avatar for Jammie

Hi, Could someone tell me if there's a better way of doing this? I was asked this question in an interview and I wrote a piece of code of O(n2). // This function returns a new string of the common alphabets found in a and b char* intersection(char*a, char* b) …

Member Avatar for Jammie
0
856
Member Avatar for waqarafridi

Can some body know a function that removes white spaces in begining and end and also removes '\n' or '\0' from a file in C language

Member Avatar for Dream2code
-1
150
Member Avatar for neerajanamratha

Hi All, I am trying to call third party dll from C program. This third party dll is written in C. I am using microsoft visual studio 2005. Could anyone please give me steps to add dll tot he project and to call from C program? I am new to …

Member Avatar for neerajanamratha
0
2K
Member Avatar for kalodakilla

Hello, i'm a newbie to Linus so there are many commands that keep me questioning. My task is to write a program that will execute a list of commands from a text file. Everything go smooth except for the command execve, its prototype is something like [iCODE]int execve ( char …

Member Avatar for kalodakilla
0
282
Member Avatar for louieansonng

Hi, I'm a student in Computer Science and we have a machine project due on August 20. The problem is, the professor only taught us the basics of C programming, the functions, switch statements and whatnot, and now they're giving us a project about making a game. The game is …

Member Avatar for Salem
0
133
Member Avatar for urbancalli

[code] BOOL SaveTextFileFromEdit(HWND hEdit, LPCTSTR pszFileName) { HANDLE hFile; BOOL bSuccess = FALSE; hFile = CreateFile(pszFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(hFile != INVALID_HANDLE_VALUE) { DWORD dwTextLength; dwTextLength = GetWindowTextLength(hEdit); // No need to bother if there's no text. if(dwTextLength > 0) { LPSTR pszText; DWORD dwBufferSize = dwTextLength …

Member Avatar for Tom Gunn
0
217
Member Avatar for tzahiel

Hay, I looking for open source code in c language which schedule/deschdule a functions that will run in a new threads, so for example I can schedule the function to run every 30 minutes in new tread. I want to use this source in my program as an infrastructure service. …

Member Avatar for Salem
0
68
Member Avatar for sal9000

Hello, and thanks in advance :) I'm currently working on solving an ODE, which I already know what it the solution supposed to "look like" . I wanted to try with GSL ODE solvers, but I'm having some trouble, because I'm getting something completely wrong! I just wanted to see …

Member Avatar for sal9000
0
194
Member Avatar for ndfi54

My IsPerfect function aint working and I dont no where i went wrong. [CODE]bool IsPerfect(int num) { int sum = 0; int x; int divisor; x = num; while(x > 0) { divisor = x; if(num % divisor == 0) { sum += divisor; } x--; } if(sum == num) …

Member Avatar for John A
0
81
Member Avatar for funjoke88

1. Write a C program to read a list of books from a file and create a linked list to store them. The purpose of this program is to keep track of the books kept in a shelf. The shelf is a three-tier shelf and each tier can store up …

Member Avatar for funjoke88
0
94
Member Avatar for adarshcu

I saw this small code of a program to print HI without a semicolon in the program. I don understand how it works. [code] int main() { while(printf("HI")-2) {} } [/code] Any help would be appreciated.

Member Avatar for adarshcu
0
108
Member Avatar for 666kennedy

I am currently working on a real time operating system(freertos) task, there are 3 tasks here and the problem im having is with the 1st task. it is basically to have 2 modes, toggled by a single button "RIGHT" (keys = ~PTH & BOTH). this has got to go basically …

Member Avatar for wildgoose
0
5K
Member Avatar for Mahen

hi everyone, I've seen that in C we can call functions from DLL's, but i don't know how, can you please clear my ignorance or divers me to a website where i can learn it. Thanks

Member Avatar for Bertie
0
131
Member Avatar for TheBeast32

Hi, I'm making a little program that will send email. I am fine with the sockets, but I keep getting a segmentation fault and I don't know why:$. I'm trying to make a loop that will let the user enter the data for the email, ending with a '.' on …

Member Avatar for wildgoose
0
188
Member Avatar for msteele

I'm coming from the PHP world, and it's nice to see the similarities between C & PHP. But I have so many questions! :) This is a simple fopen() script, easily found online. What I am wondering about is the buffer variable. I think I understand that it's only looking …

Member Avatar for Ancient Dragon
0
175
Member Avatar for faraheneh

Hi all, I'm just a newbie and I need your help, I should write a code about NRU and frankly speaking, I don't know what to do:$ . do you have some related codes, so I can undrestand where to begin and how to do it? any suggestions would be …

Member Avatar for Tom Gunn
0
86
Member Avatar for ichie06

Make A C Program That Performs The Following Algorithm: (a)Use Scan F To Input The Following Data: -assign Value 26 To Age. -assign Value 80 To Weight In Kg. -assign The Value 183.219 To Height Cm. (b)Calculate The Weight-to-height Ratio. (c)Display A Heading For The Results (d)Display The Results In …

Member Avatar for mvmalderen
0
107
Member Avatar for elitedragoon

This program requires the user to input data, after which it calculates. After calculating all the users it puts it prints it onto a document and screen. After which it gets sorted by name, the data gets outputted to another screen displaying a fake check that includes that is grabbed …

Member Avatar for Salem
0
217
Member Avatar for ndfi54

Im trying to write a program to print all the primes from 1 to 100. I am however required to use a boolean function. My problem is that all the odd #s except 1 also appear in the output. [code] #include "stdafx.h" #include <stdio.h> #include "strlib.h" #include "genlib.h" #include "random.h" …

Member Avatar for ndfi54
0
243
Member Avatar for msteele

I've noticed a few different ways people write the main() function. int main{ } main(void){ } void main(){ } I'm confused with what's considered "best practice" or why I'd choose one over the other. Is there a difference? thanks!

Member Avatar for MosaicFuneral
0
146
Member Avatar for DaveTul

Thanks for at least reading. My assignment is to prompt for a filename, change the contents to caps, and print. I have the following, and it's giving me the error at line 25 (the inside loop) Assignment makes integer from pointer without a cast What does that mean, and how …

Member Avatar for iamthwee
0
137
Member Avatar for dknoebber

This is my first C program. I am modifying an existing program to have input and when I added two lines of code to 1) print "Enter Purchase Amount" and 2) scanf to capture the data my other printf statement received a compile error that it has the wrong # …

Member Avatar for DoEds
0
191
Member Avatar for DoEds

//This program will ask the user for k, m and n. //k should not be equal to 1. //Output all numbers multiple by k between m and n. (ex. k=2,m=5,n=20 output should be 6 8 10...18) *problem* How to exit this program when the user assigned k to 1 ? …

Member Avatar for DoEds
0
97
Member Avatar for jcollins85

Hi I'm running this on a mac and when i use '\n' it prints the entire contents of the pointed to text file. looking for '\r' just cause an infinite loop. Any idea what the problem might be? [code] #include <stdio.h> #include <stdlib.h> int main(void){ FILE * input; char * …

Member Avatar for jcollins85
0
153
Member Avatar for karpaklu

hai dani, how to create a vertical histogram in c using graphics header file.

Member Avatar for vimalamtwu
0
80
Member Avatar for MrNoob

hey guys i know its kinda noobish not to understand them since i been coding for 1 month but there rlly some stuff which confuses me in multidimensional array and nested loops like here in this program I wanted to know if i sum up like in the array for …

Member Avatar for MrNoob
0
146

The End.