18,490 Topics

Member Avatar for
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
112
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
113
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
900
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
163
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
351
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
154
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
239
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
75
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
211
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
87
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
115
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
121
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
158
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
209
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
195
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
101
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 tux4life
0
129
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
249
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
272
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
175
Member Avatar for hoti99

i want to simulate something in asm like strcat function in C strcat("Hello",World") ==> Result "HelloWorld" please help me to do this iam very begginer in coding i need just a simple code .model small .stack 64 .data ;******************************** s1 db 'hello ' s2 db 'world' ;******************************** .code main proc …

Member Avatar for wildgoose
0
740
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 Member #46692
0
159
Member Avatar for wicked357

I started this macro that does the following in MASM, 1. takes the user input for character entered 2. copies character from AL to _char variable 3. converts to ascii value and outputs to console I was able to do the first 2 having issues with the conversion process. Here …

Member Avatar for NotNull
0
322
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
220
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
122
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
191
Member Avatar for karpaklu

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

Member Avatar for vimalamtwu
0
100
Member Avatar for colmcy1

Hey all, I am trying to check if a .exe file is open, if it is open bring it to foreground, if it is not open open .exe file and bring to foreground. The code I have written doesnt seem to recognise if the program is open or not as …

Member Avatar for colmcy1
0
2K
Member Avatar for weeken88

Ei guys... I'm about to make a project involving the use of a LAN cable/port and c++ I would like to use c++ to to send bit (Binary Output) outputs through a LAN cable. just like what we do with c++ and parallel ports, but this time I'll be using …

Member Avatar for weeken88
0
106
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
183
Member Avatar for 9868

Here is a code: [CODE] #include<stdio.h> #include<string.h> int main(void) { char *s1="hello"; char *s2="world"; char *s3; s3=strcat(s1,s2); printf("%s",s3); } [/CODE] What does strcat returns? Why does this code results in run time error? And one more question : Are "hello" and "world" terminated with '\0' in case of char pointers? …

Member Avatar for Ancient Dragon
0
94
Member Avatar for Para2x

[B]Hello to All i want to read txt file that contant some data's such as :[/B] [CODE]1,2,3,4,5,6 7,8,9,10,11,12 13,14,15,16,17,18,19[/CODE] [B]and then write them into a two dimentional Array .[/B] for example : first line of file must be first row of array or another example the first data in first …

Member Avatar for Aia
0
146
Member Avatar for Dream2code

While we allocate memory using malloc/calloc.That much bytes is reserved by the program.When the program terminates and we didnot free it what happens exactly? How to check memory usage by a program by writeing a C program.

Member Avatar for Dream2code
0
151
Member Avatar for fuggles

I am on a project that requires the use of C# and C++, is it possible to compile both languages in the same compiler without spending $200 on the full version. When I try to add a .cpp file to C# it says 'Make sure you have installed (.cpp) files.' …

Member Avatar for Ramy Mahrous
0
52
Member Avatar for Kurt Kubing

How can I obtain font properties thru a font file (*.otf;*.ttf or PostScript fonts)?

Member Avatar for Dream2code
0
147
Member Avatar for mrestrepo30

Hi! I'm just starting to code in C, and I'm trying to read the information in a dat file, to then use it in some calculations. I read the information in the file and then save it in an array. However when I try later to access that array I …

Member Avatar for Dream2code
0
162
Member Avatar for olarotimi73
Member Avatar for ithelp
0
309
Member Avatar for anne_1000

Dear all, I have a weird problem reading a file using fgets. The code below should read the first line of the file "F:\\filename.csv". It works for all sorts of files that I create myself, but it does NOT work for certain files that I download from the internet. More …

Member Avatar for Dream2code
0
322
Member Avatar for bryangarcia

what does this mean: read value of the integer variable [I]first_int[I][/I][/I] from the user's input? i dont know what's the proper c statement for this... i'm trying my code but there's always an error...

Member Avatar for csurfer
0
162
Member Avatar for Member #570982

Hi everybody! I'm Manu. I'm a linux c freelance developper. Beside I'm a musician and I've been playing the guitar for almost 20 years now (I'm getting old!) This site seems quite cool. I'm in open source so I like the sharing concept behind. Well, that's it, cheers! Manu TM

Member Avatar for debasisdas
0
39
Member Avatar for bryangarcia

Good day to all, i'm just starting to learn c language...and i have a something to know ... is the opening curly bracket and closing curly bracket mean that it will end and begin a segment in c? thank you...

Member Avatar for csurfer
0
172
Member Avatar for Member #570982

Hi everybody! I,ve made a 'news ticker' app for linux in c and gtk+. Now 'm porting it to win xp using mingw. The problem is the win xp version is slower. Basically, the image is refreshed every interval ms. I've set a timeout using g_timeout_add_full(interval, handler, ...) in the …

0
49
Member Avatar for bubblellicious

Hi there. That's my first thread here. Maybe my english level is not good as yours coz i'm from Spain xD First of all, I have a constant string which has a thousand of chars, with no empty positions, only characters. And I have to find repetitions of 6-letter and …

Member Avatar for bubblellicious
0
138
Member Avatar for yara naser

please can you help me to translate this code from c to c++ /*************************************************************** Program describtion : ===================== This program is for creating a Lexical Analyzer in c Created by : ============= CoMPuTeRQ8 kuwait university Major : COMPuTeR-SCIeNCe *****************************************************************/ /**************************************************************** Necessary Header files used in program. *****************************************************************/ [code=c] #include<stdio.h> #include<string.h> …

Member Avatar for necrolin
0
193
Member Avatar for shtikk

can you help me make a typing game of falling letters(randomly), and as the player presses the key of the letter, the letter being pressed will vanish and points will be gained by the player. Thank You.

Member Avatar for Salem
0
163
Member Avatar for Dream2code

Hi All, My requirement is like this.It a part of a software devlopment team as i am devloping a tool its a part of it. Its bit long but my explanation is clear to get it. 1)we need to read a data file using a description file. Usage: programname <description_file> …

Member Avatar for Dave Sinkula
0
526
Member Avatar for calicocat

I am trying to improve a program I have, but there is one thing I cannot figure out to do... so, trying to make this short, this is what I'd like to accomplish: Is there a way for C to count how many variables are equal to a particular value? …

Member Avatar for Dream2code
0
113

The End.