15,551 Topics

Member Avatar for
Member Avatar for icewolf

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); …

Member Avatar for icewolf
0
4K
Member Avatar for SIFA

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 …

Member Avatar for Ancient Dragon
0
131
Member Avatar for johndoe444

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 …

Member Avatar for aspire1
0
77
Member Avatar for urbangeek

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 …

Member Avatar for urbangeek
0
1K
Member Avatar for girishn

#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') …

Member Avatar for Ancient Dragon
0
114
Member Avatar for johndoe444

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 …

Member Avatar for jephthah
0
221
Member Avatar for KMW12345

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 …

Member Avatar for jephthah
0
653
Member Avatar for girishn

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 = …

Member Avatar for WaltP
0
112
Member Avatar for avsatheesh

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]

Member Avatar for Ancient Dragon
-3
186
Member Avatar for kincaide3

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...

Member Avatar for kincaide3
0
48
Member Avatar for prettyann

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 …

Member Avatar for jephthah
1
140
Member Avatar for max.v8

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 …

Member Avatar for max.v8
0
175
Member Avatar for whatThewhat

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 …

Member Avatar for whatThewhat
0
127
Member Avatar for HeavySoul

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 …

Member Avatar for girishn
1
133
Member Avatar for doom5

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) = …

Member Avatar for girishn
1
140
Member Avatar for bhanukarumudi

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) { …

Member Avatar for Ancient Dragon
-1
102
Member Avatar for infrapt

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) ; …

Member Avatar for Ancient Dragon
0
103
Member Avatar for prade

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 …

Member Avatar for gerard4143
0
164
Member Avatar for yasokrish

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) { …

Member Avatar for muditAggarwal
0
160
Member Avatar for karthiken07

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.

Member Avatar for Ancient Dragon
0
155
Member Avatar for shahab.burki

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 …

Member Avatar for jephthah
0
115
Member Avatar for Vytautas

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 …

Member Avatar for jephthah
0
1K
Member Avatar for Xufyan

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); …

Member Avatar for jephthah
0
140
Member Avatar for Xufyan

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 ? …

Member Avatar for jephthah
-2
163
Member Avatar for shamly
Member Avatar for raigs

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 = …

-1
120
Member Avatar for ilkeamasya

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 …

Member Avatar for Banfa
0
113
Member Avatar for jephthah

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 …

Member Avatar for nezachem
0
134
Member Avatar for shahab.burki

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; …

Member Avatar for shahab.burki
0
266
Member Avatar for MWE_QUE

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 …

Member Avatar for MWE_QUE
0
109

The End.