15,551 Topics
| |
Hi There. I am trying to use libCurl to copy the contents of a webpage into a string in C. This is what I have so far: [CODE]void Cmd_translate_f (char *message) { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, va("http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=%s!&langpair=en|fr"),message); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); res = curl_easy_perform(curl); … | |
Can someone help me to make my function getbase2 to work? It needs to return a string value. [CODE]#include<stdio.h> char GetBase2(int iBase, int iNumber); int main() { int i; int number; printf("Enter number: "); scanf("%i", & number); printf("Enter base: "); scanf("%i", & i); printF("Conversion: %s\n",GetBase2(i,number)); } // Base 11 upwards … | |
1. What is the difference between the system and exec family of functions? 2. I want to collect the output of the call from the system functions say. Say I execute this system("date"); Now say I don't want it to display the output rather it give the output as an … | |
hello guys, the output of the program should be like this: [ICODE] With how many numbers do you love to work with? 3 Enter no 1: 23.4 Enter no 2: 15.54 Enter no3: 55.48 In ascending order the numbers are: 15.54 23.40 55.48 [/ICODE] I've written this program: [CODE] #include … | |
#include<stdio.h> void squeez(char s[],char z[]); int main() { char s[100] = "Hey wassup !!!!!!"; char z[100] = "Wow cool!!!!!"; squeez(s,z); return(0); } void squeez(char s[] , char z[]) { int j,dummy = 0,i=0; char x[100]; for(j = 0 ; s[j] != '\0';j++)/* the starting loop */ { while(z[i] != '\0') … | |
If say I have only the binary of a another source file (no original source is available), then how to create this with my own program. Like say I have a source file containing some function print_hello() Now I compile it and get the binary lib.o Now another program test_lib.c … | |
Hi. I am also having a standard deviation problem. When I try to calculate the sandard deviation of the numbers below with the suggested algorithm, I run into square root of a negative number. The algorithm does work for some data sets, but neither this one or 8 others. Does … | |
Here is the source code I came up with: #include <stdio.h> #define SPACE ' ' int main(void) { char c, prev; int space, newline; long other; space = 0; newline = 0; other = 0L; printf("Enter text to be analyzed (# to terminate):\n"); __fpurge(stdin); /* clears buffer */ while((c = … | |
number of iterations in the following loop [CODE]main() { int x=5, y=10, z=9 for (;x<=5;) {y++;z--; x=x+1/2; if(z==0) z=y;}}[/CODE] | |
hi all, i need help... ok, about the 2nd statement... [CODE] unsigned char buffer[BUFSIZ]; ... buffer[i] ^= argv[3][j++]; [/CODE] ok buffer contains characters from a file... so im a little confused about what that statement does... both the "^=" and the argv part... can anyone explain? thanks in advance... | |
Hi. I have a bit of a problem with this code: [CODE] #include <stdio.h> #include <conio.h> #include <stdlib.h> main () { FILE *data; char let; int prior, ctr; data = fopen("huffman_table.txt", "r"); while (fscanf(data, "%c%d\n",&let, &prior)!='\0') { printf("\nLetter: %c Priority: %d", let, prior); } fclose(data); getche(); } [/CODE] The huffman_table.txt … | |
Hello guys, this is my first time in these forums, so I apologize for my bad English. Well, here's the problem: I need to get the frequency of integer numbers that are stored in a file, their range is from 0 to 100, their amount is unknown and depends on … | |
I really need some help implementing counters. I have to count the suits and faces drawn from the deck but for some reason all outputs is junk numbers. Am I missing something? I what it to come out something like this: Say a player is dealt: Ace of Hearts Ten … | |
Hi people, my first post here, hope its a good one. I am trying to develop a program which will simulate a very simple name server, using the client-server frame. My problem appears after the server receives the data (in form of a string) from the client and tries to … | |
I'm teaching myself C, and wrote this string reverse function. I cannot figure out why it is crashing... [code=c]#include <stdio.h> void ReverseString(char *inStr, int length); void ReverseString(char *inStr, int length) { char temp; int j=length; int i=0; while( i != j) { temp = *(inStr+i); *(inStr+i) = *(inStr+j); *(inStr+j) = … | |
it is not complete.........u may need to do some modifications Regards, Bhanu[code]#include<stdio.h> #include<pthread.h> #include<signal.h> struct lift { int status; int movement; }l[8]; struct floorno { int curfloor; int destfloor; }f[8]; int i; void main() { int ch; int j; for (j=0;j<8;j++) { l[j].status=0; l[j].movement=0; } pthread_t lift[8]; j=0; while(1) { … | |
Hi I am trying to malloc align each location of an array to 128 bits. I am using the method malloc_align in linux to align arrays and so on. But in this case I want to align each position of an array to 128 bits for(i=0;i<size;i++){ //N=7 2^N=128 array[i]=malloc_align(sizeof(double),7) ; … | |
hi, i i recently installed dev c++ 4.9.9.2 ....the first hello world program i wrote gave me some insane messages when i compiled & the exe files which gets created...my antivirus detects them as trojan flies & deletes them....i tired & re -installed dev again but it didnt help...please help … | |
Hi,am newbie to c programming.can u explain the above c program which reads a file more than its capcity.. i couldn understand more than this.. Thanks,Yasokrish.[code]#include <stdlib.h> #include <stdio.h> #include <string.h> int bof(FILE *badfile) { char buffer[12]; fread(buffer, sizeof(char), 40, badfile); return 1; } int main(int argc, char **argv) { … | |
I need to write some contents in the text file (notepad), with some specified font, and size .is it possible in C, kindly let me know. | |
I have problems in decrypting the text using AES in C. the code is belwo. [CODE]#include <stdlib.h> #include <openssl/evp.h> #include <string.h> int main(){ //declaring the variables char source[6]="Shahab"; char target[6]; char output[6]; char mykey[EVP_MAX_KEY_LENGTH]="hardtobreak"; char iv[EVP_MAX_IV_LENGTH] = "an_iv"; int in_len, out_len=0; int check; EVP_CIPHER_CTX ctx; in_len=strlen(source); printf("This is the text … | |
| Hey, guys, to begin with, I'm a complete newbie to C and I'm writing a Knight Tour program. The idea of my program is to check every possible way (it is necessary for the assignment), so I start with x + 1 & y + 2 and so on. If … |
Hello using conditional operators I want to make a program that ask user to input three values and print the maximum among those three values. i have done for two values but dont know the logic for three values. [CODE] int main(void) { int a,b,c,d; printf ("first value"); scanf ("%d",&a); … | |
How can i convert this pr0gram in conditi0nal operat0rs...? I don't kn0w h0w to use more than tw0 conditi0ns in c0nditi0nal 0perat0rs. We've learned to use two conditional operators conditions s0 far, for example, [iCODE] (a>b)? a:b ; [/iCODE] but don't kn0w how t0 apply it for 3 c0nditions ? … | |
program to calculate number of spaces in the string | |
The prototype for setsockopt is: [CODE]int setsockopt(int socket, int level, int option_name, const void *option_value, socklen_t option_len);[/CODE] Are the following all correct ? Which are not ? [CODE]int buffsize = 50000; setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&buffsize, sizeof(buffsize));[/CODE] [CODE]int buffsize = 50000; setsockopt(s, SOL_SOCKET, SO_RCVBUF, (void *)&buffsize, sizeof(buffsize));[/CODE] [CODE]char *buffsize = … | |
For example i have an array like: a[20]={1,5,7,8,4,3,12,15,15,15,11,...} lets say that the max Value of this array is 15. i want to write : "The max value of array a is 15 and it is located at 8th,9th and 10th element in array. " Is it possible to write a … | |
i know the general answer to using [ICODE]goto[/ICODE] is always "No!". I understand why, especially when teaching basics to new programmers, because it can lead to very bad practices and horrible spaghetti code. but ... when i write certain hardware drivers, i have to immediately cease executing a function if … | |
I am doing some AES encryption using C. But the errors ocurred. The code is following by the error displayed. 1 Code [CODE]#include <stdlib.h> #include <openssl/evp.h> #include <string.h> int main(){ //declaring the variables char source[6]="Shahab"; char target[6]; char mykey[EVP_MAX_KEY_LENGTH]="hardtobreak"; char iv[EVP_MAX_IV_LENGTH] = "an_iv"; int in_len, out_len=0; int check; EVP_CIPHER_CTX ctx; … | |
Thanks for any help. Most of this works, but I get a compiler error on lines 60, 84, and 105, where it says [CODE] current = currentStore->link [/CODE] The error reads "assignment from incompatible pointer type" It runs, but in the printStores function when i gets incremented on line 81 … |
The End.