18,490 Topics
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 …
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.
[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 …
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) …
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
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 …
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 …
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 …
[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 …
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. …
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 …
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) …
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 …
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.
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 …
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
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 …
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 …
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 …
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 …
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 …
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" …
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!
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 …
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 …
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 …
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 # …
//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 ? …
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 * …
hai dani, how to create a vertical histogram in c using graphics header file.
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 …
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 …
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 …
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? …
[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 …
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.
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.' …
How can I obtain font properties thru a font file (*.otf;*.ttf or PostScript fonts)?
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 …
hello, i want to know how I can book online flight reservation ?
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 …
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...
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
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...
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 …
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 …
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> …
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.
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> …
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? …
The End.