15,540 Topics

Member Avatar for
Member Avatar for gameon

hey i used findfirst and findnext function but they can access only a path which is given by us. i want to access all folders and file of a drive like a antivirus do, when it scans the drive.... do u know how can we do it using c language?

Member Avatar for Aia
0
190
Member Avatar for xenanovich

hi, (on a linux system) i wrote the following code snippet to 1. write to a serial port 2. read the data that i have just written to the serial port. the write is functioning, but the read is not. if i use just the read (without "write", but by …

Member Avatar for xenanovich
0
1K
Member Avatar for lionaneesh

[code]// Dumps raw memory in hex byte and printable split format void dump(const unsigned char *data_buffer, const unsigned int length) { unsigned char byte; unsigned int i, j; for(i=0; i < length; i++) { byte = data_buffer[i]; printf("%02x ", data_buffer[i]); // Display byte in hex. if(((i%16)==15) || (i==length-1)) { for(j=0; …

Member Avatar for WaltP
0
206
Member Avatar for Silen

I'm writing a cross-platform code and I need to be sure the following won't make me trouble. [code=c] struct X { unsigned char a:3; unsigned char b:5; }; [/code] Is using other then int types is part of the ANSI C? Will it be compiled with every compiler?

Member Avatar for Silen
0
133
Member Avatar for Xufyan

i want to write a program that prints the value in array which are at odd position, i've this for single dimensional array but confused about 2-D array. Single dimensional: [CODE] int main(void) { int num[10]; int i; for (i=0;i<10;i++) { printf ("Enter %d value: ",i); scanf ("%d",&num[i]); } for …

Member Avatar for Xufyan
0
168
Member Avatar for lionaneesh

[CODE] #include<stdio.h> #include<string.h> #include<arpa/inet.h> #include<netdb.h> #include<sys/types.h> #include<sys/socket.h> #include<fcntl.h> #include<sys/stat.h> #include<stdlib.h> #include<time.h> int main() { FILE *logs; logs = fopen("/home/aniroot/logs/log.txt","a"); if(logs = NULL) { printf("fopen failed ... There would be no log for this session!!!"); } int sockfd,newfd; int err; struct addrinfo *res,*p,hints; struct sockaddr_storage their_addr; socklen_t addr_size; int yes=1; char …

Member Avatar for abhimanipal
0
134
Member Avatar for Dave Sinkula

Many times [inlinecode]strtok[/inlinecode] is recommended for parsing a string; I don't care for [inlinecode]strtok[/inlinecode]. Why? [list][*]It modifies the incoming string, so it cannot be used with string literals or other constant strings. [*]The identity of the delimiting character is lost. [*]It uses a static buffer while parsing, so it's not …

Member Avatar for Aia
0
1K
Member Avatar for gkaykck

Hi I am trying to make my homework about a command line calculator, and i am trying to divide the entered string into small parts and i am trying to use strtok for this. [CODE] #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> struct var { char name[10]; double value; …

Member Avatar for gkaykck
0
592
Member Avatar for Iam3R

Hi , i know one method of deleting a record from a binary file. that is : read the contents of the file and every time check for some criteria based on which we want to delete the record. if record does not match criteria then write to new file …

Member Avatar for Adak
0
1K
Member Avatar for comput scince

i have a project anc i need to do an interface to my c program , there is any functions to do it?

Member Avatar for comput scince
0
84
Member Avatar for menonnik

I have a code like [code] int a=10; a=(++a)+(a++)+(a++)+(a--)+(--a); printf("%d",a); [/code] this gives the output as 51. while [code] printf("%d",(++a)+(a++)+(a++)+(a--)+(--a)); [/code] gives 56 as ouput. can you please explain the flow in both the statements.

Member Avatar for JuhaW
0
94
Member Avatar for Ferny84

Hi everyone, I am having some trouble here... I am asking the user to enter a file, and that file will read the contents and determine if the student will pass or fail the class. That part I am having trouble with is when I have to decide if the …

Member Avatar for csmgsarma
0
119
Member Avatar for darkdai

hey everyone, im tryin to generate random strings and store them in an array. can anyone please show me?

Member Avatar for Narue
0
118
Member Avatar for MrDiaz

Hey folks, I am trying to normalize a view on a given output. This is how it works, I need to print several characters but the maximum chars i can print have to be 40 per line. [QUOTE]aaaaaaaaaaaaaaaaaaaaaaaaaaaaa...till 40 aaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbb[/QUOTE] The algorithm works as follows: I have to find …

Member Avatar for MrDiaz
0
124
Member Avatar for MrDiaz

I have an array codes[26] which contains numbers inside {25,4646,23,12,.....29} Each position in the array corresponds to a letter of the alphabet. code[0] is a, code[1] is b, etc... I'd like to print the occurrences of each letter, something like this. If there are 12 A's, 5 B's AAAAAAAAAAAAA BBBBB …

Member Avatar for MrDiaz
0
114
Member Avatar for cmsc

I'm trying to run this code in cygwin 1.7 but i get segmentation fault when I choose to search. I tried this in cygwin 1.5 before but it works. does anybody know the reason why it won't work in cygwin 1.7? here's the code [CODE] /**************** Rachel Perono running BST …

Member Avatar for Tellalca
0
115
Member Avatar for MrDiaz

Hey everyone, I have a series of loops that read through a text file and then output the occurrences for each letter on the file. This seems to be fine when using small text only. When providing a lot of text it just takes too many CPU resources and that's …

Member Avatar for Tellalca
0
115
Member Avatar for lionaneesh

[CODE]/* This function accepts a socket FD and a ptr to a destination * buffer. It will receive from the socket until the EOL byte * sequence in seen. The EOL bytes are read from the socket, but * the destination buffer is terminated before these bytes. * Returns the …

Member Avatar for abhimanipal
0
193
Member Avatar for tenix

Hi, Is it possible to read a file only to get the first 100 bytes from the begining and the last 100 bytes at the end? I have to get info from files that are in the first 100 bytes and in the last 100 bytes of the file and …

Member Avatar for tenix
0
8K
Member Avatar for tskellyfla

Hi, I'm a student learning to code in C. This is what I have only when I compile it, gcc, I get two error messages and I don't understnd why. The messages are '67: error: expected declaration or statement at end of input' and '67: error: control reaaches end of …

Member Avatar for Aia
0
264
Member Avatar for MrDiaz

Hi folks, I've been trying to solve this but I keep hitting a brick wall. Here's what I am trying to do: I'm reading a file with text in it, I am storing every letter of this file as an element of this array (this part is already done) and …

Member Avatar for Ral78
0
99
Member Avatar for tenix

Hi, I am total new in C. I have an array, then i loop it to get array elements. How can i add this array element into existing array? thank! [CODE] char arr[] = {1}; for (int i = 0; i < sizeof(arr)/sizeof(arr[0]); i++ ) { something happend here = …

Member Avatar for tenix
0
16K
Member Avatar for vanalex

Hello everybody! I have a little problem in a piece of code that seems quite simple. This piece of code reads float numbers till the user hits the number -999.9. When he/she does then the program ends. So i write [code=c]float n; scanf("%d", &n); while (n != -999.9) { i++; …

Member Avatar for Tellalca
0
104
Member Avatar for Ancalime

I triying to write a program with array and functions. But it's realy hard to solve it with my restricted knowledge. Help me please. The problem is: Write a program where a user can insert integers to an array, find an integer (i.e. find the index of an integer previously …

Member Avatar for Aia
0
164
Member Avatar for ce0

hello all i have a problem with a "while condition" useing c. my assignment was to create a dynamical array, using malloc. i did that and all worked as it should. the only thing i dont like,is when it asks you if you want to continue, putting in integer. you …

Member Avatar for Tellalca
0
4K
Member Avatar for gameon

hello i have a problem...i want to insert a pic to my c program. is it possible to import a pic in c? if it is, how can we do it?

Member Avatar for Tellalca
0
132
Member Avatar for krap_nek

Hey guys, What I'm trying to do is a function that gets a certain array of structures and print some of the information on the screen, like the name and id_number. The thing is that some fields in the structure are repeated and my goal is to show only one …

Member Avatar for Tellalca
0
115
Member Avatar for 4erepa

I have recursive function,that i need to convert into iterative version... but can't understand how to do it - 2 hours at least :( [CODE=c] double sequence(int n) { double sum,i; if(n <= 30) return 2*n; else { for(sum =0,i = 1;i <= 30;i++) sum+= sequence(n-i); return sum/30; } }[/CODE]

Member Avatar for Tellalca
0
55
Member Avatar for Freespider

i got an assigment, for tomorow, i have a text file, and i need to convert it to binary file. text file for example: 2 - how many products ipod 1000 2 - product name, price stock playStation 23 9 i need to preper this binary file: first the size, …

Member Avatar for abhimanipal
0
105
Member Avatar for Alerwiali

/* In this program i am trying to Read these info from a text file called unsorted saved in D These info are A201456 23.15 B209356 6.58 C201232 7.5 D201172 1.2 E201653 3.68 1)i want to sort them in ascending order of the real number example (23.15 ). 2)I want …

Member Avatar for abhimanipal
-1
162

The End.