15,551 Topics

Member Avatar for
Member Avatar for Xheis

Hi, I have this code in C for Flex/Lex, the only problem is that as I try to compile it it shows some errors and I dont know how to fix them. letter [a-zA-Z] digit[0-9] %% {digit}+("E"("+"|"-")?{digit}+)? printf("\n%s\tis real number",yytext); {digit}+"."{digit}+("E"("+"|"-")?{digit}+)? printf("\n%s\t is floating pt no ",yytext); "if"|"else"|"int"|"char"|"scanf"|"printf"|"switch"|"return"|"struct"|"do"|"while"|"void"|"for"|"float" printf("\n%s\t is …

Member Avatar for Tumlee
0
879
Member Avatar for finston

I have added some additional code to the Get_PrintDC function of my Sipprt.c code so as to get the print out in landscape rather than the default portrait format. The code reads as follows (the additional code is inserted after the return CreateDC line): HDC NEAR Get_PrintDC( void ) { …

Member Avatar for finston
0
242
Member Avatar for Na'Vi

Hi, I'm having a minor problem with output with printf. I understand you escape % in printf with %% so if I had some string it would be printf("%%eax"); But if I have printf("%%%s", registers(C)); I get an an output of %%eax, which is one too many percent signs. I …

Member Avatar for nullptr
0
150
Member Avatar for Nirav.gohel23

Hello Friends, First of let me clear you that it not a fake blog.This blog is created for the students of computer field and sharing the programming concept to the people of IT.From this you will be connected with latest technology and programming questions with answer.Friends this just an beginning …

Member Avatar for deceptikon
0
147
Member Avatar for Amy Rami

how to represent an exist directory into an XML file ?? is there any system call to do that or there is a good built in library to use it ??? I wrote this #include<stdio.h> #include<stdlib.h> #include<string.h> #include<dirent.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> int main ( int argc, char …

Member Avatar for Ancient Dragon
0
85
Member Avatar for anumash

Is there a way we can decrement a file pointer. I searched online and I found the ungetc() function but what if we want to decrement the file pointer to point to the last string in the database? Also, how does ungetc *put back* a character?? Explain. Thanks in advance!!

Member Avatar for deceptikon
0
304
Member Avatar for anumash

I am trying to open a text file which contains a dictionary of english words. Each word and it's definition are on the same line and the entries are delimited by a newline. Now, my question is that if you open a text file using fopen() in "rt" mode then …

Member Avatar for deceptikon
0
211
Member Avatar for ram619

Hi, can anyone please tell me how to create a array of 20 crore (200000000) elements. I tried, but getting runtime error, might be that much memory is not available. Thanks

Member Avatar for Adak
0
203
Member Avatar for SamJo22

I'm trying to write a web server but with the code I have but I'm getting the GET/ht.html can't be opened. The html document (ht.html) is supposed to be opened in the browser. What can be added or changed so it'll work properly? The code I have is: #include <sys/types.h> …

Member Avatar for Banfa
0
330
Member Avatar for nob_100

I am writing a program about sorting an int array. What I have to do is to just modify the pointer array so that the original content of the array will not be changed. Noted that it is not allowed to creat an new array. So what should I do …

Member Avatar for Adak
0
277
Member Avatar for kishore84

Hello friends did anybody have implemented the ant based clustering algorithm in C.If so can u pls pass me on the coding.It would of great help to me.

Member Avatar for Adak
0
365
Member Avatar for anestistsoukalis

#define StackLimit 50 // ôï üñéï ìåãÝèïõò ôçò óôïßâáò, åíäåéêôéêÜ ßóï ìå 50 #include <stdio.h> typedef int StackElementType; // ï ôýðïò ôùí óôïé÷åßùí ôçò óôïßâáò //åíäåéêôéêÜ ôýðïò int typedef struct { int Top; StackElementType Element[StackLimit]; } StackType; typedef enum { FALSE, TRUE } boolean; void TraverseStack(StackType Stack); void CreateStack(StackType *Stack); …

Member Avatar for rubberman
0
182
Member Avatar for thefaceofk

I need help in this c program i need to have a delete function that will delete a specific string(or a line) in my FILE Is reading the string from the file and putting them in an array, okay? #include <stdio.h> #include <string.h> struct { char title[100]; char author[100]; char …

Member Avatar for Adak
0
236
Member Avatar for mallikaalokam

**I Know Main is a primary funtcion in C...But Is there other reason ..like why they named it as main only and not other??? ..and why we have to write main() compulsory in prgoram...Any histroy behind it??** Help ME Please.......

Member Avatar for deceptikon
0
141
Member Avatar for pinkesh25gar

#include <stdio.h> #include <stdlib.h> #include<LPC214x.h> #define ledon IO1SET #define ledoff IO1CLR void delay(int x); #define READY 1 typedef int (*compfn)(const void*, const void*); struct task { int task_id; int period; int wcet; int arrival_time; int deadline; int state; int ceu; }; int sim_time=10; struct task array[3] = { { 1,4,1,0,4,1,0 …

Member Avatar for pinkesh25gar
0
151
Member Avatar for Fredszky

So i'm trying to make multiple clients logon to a server through filesockets, and perform simple commands like ls -l, ls, mkdir. I've managed to make one client recieve output of ls -l command, sometimes, its buggy. Now i've been sitting for days trying to figure out how to fork() …

Member Avatar for Fredszky
0
6K
Member Avatar for Landoro

Hello everyone!I have started the book Algorithms in C by Robert Sedgewick and at the end of each chapter there are additional practice problems for solving.I stumbled on one that I can't seem to understand.It goes as follows: Write a function int convert() that reads a decimal number one character(digit) …

Member Avatar for rubberman
0
135
Member Avatar for durrta

Write a C program that prompts the user to enter integers (positive or negative, not including 0) from the keyboard. Your program should stop reading the numbers from the keyboard when the value 0 is entered and print the range (the difference between the maximum and the minimum) of the …

Member Avatar for zeroliken
0
124
Member Avatar for jay889000

#include <stdio.h> #include <stdlib.h> #define PRECISION 3 double absD(double n) { asm( "_absD: \n" "pushl %ebp \n" "fldz \n" "movl %esp, %ebp \n" "fldl 8(%ebp) \n" "fxch %st(1) \n" "fucomp %st(1) \n" "fnstsw %ax \n" "sahf \n" "jbe L2 \n" "fchs \n" "L2: \n" "popl %ebp \n" "ret \n" "fldl …

Member Avatar for jay889000
0
478
Member Avatar for SamJo22

I'm trying to write a web server but with the code I have I'm getting 'open failed'. The html document (ht.html) which is supposed to be opened in the browser. It seems as though the code I have is not opening the file received through the socket hence it's saying …

0
184
Member Avatar for Vish0203

Hi everyone! i'm getting strange outputs for the following code.. can anyone explain the reason for such output?? :/ I use DEV c++ int color_choose(void) { char clr[10]; int i; /*enum { green,aqua,red,purple,yellow,white }a;*/ printf("\n\n\tText color can be changed here! This the list of available colors: "); printf("\n\n\t Green\t Aqua\t …

Member Avatar for rubberman
0
120
Member Avatar for anumash

When we open a new file using the FILE structure and fopen(), the file pointer points to the first byte of the file. How can we know the location of any byte in the file using the file pointer? When I try to store the location of fp (file pointer) …

Member Avatar for anumash
0
185
Member Avatar for anumash

I have to divide a database and I wanted the statistics of each subdirectory that I am going to create. The database is a dictionary comprising of words and their corresponding phonemic translations. https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/cmudict/sphinxdict/cmudict_SPHINX_40 the database can be found here. I have written a program to count the number of …

Member Avatar for deceptikon
0
395
Member Avatar for safiulm

hi, i am working on a project in which i did some calculation on a pic24 microcontroller and now i want to send that information by uart to a bluetooth device(RN-42). the bluetooth module then sends it forward to the pc. the trouble i am facing is that i dont …

Member Avatar for rubberman
0
85
Member Avatar for fyra

Hi. The function msgget from sys/msg.h is not being recognized by Netbeans 7.2.1. Have I missed anything? OS: OpenSUSE 12.2 "Mantis" #include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> extern void exit(); extern void perror(); int main(void) { key_t key; int msgflg, msqid; fprintf(stdout, "All numeric input is expected to …

Member Avatar for Moschops
0
254
Member Avatar for zpxix

Hello All, I am very new to C programming but i was working on cryptography for ipsec and am trying to write a code for implementing a simple code for a stream cipher which will take a 20 charecter long string and a 8 bit seed file and encrypt the …

Member Avatar for Banfa
0
209
Member Avatar for fyra

Hi people. I wonder how I can free the pthreads' allocated memory? #include <pthread.h> #include <stdio.h> #include <stdlib.h> #define NUM_OF_THREADS 10 void* print_thread_id(void* tid) { printf("Greetings from thread %d\n", (*(int*)tid)); pthread_exit(NULL); } int main(int argc, char* argv[]) { pthread_t threads[NUM_OF_THREADS]; int status, i; int* n_thread; for(i = 0; i < …

Member Avatar for Banfa
0
277
Member Avatar for tony75

Hi I have a little C-program and when I run I discover alot of page fault?! How can I improve my C program to have it faster?

Member Avatar for tony75
0
226
Member Avatar for samii1017

Okay, so pretty much I have to use structs to print out information about 4 dogs. However, I can only get the first dog, Smokey's information to print. Any advice on how to get the other four to print? #include <stdio.h> #include <stdlib.h> #include <string.h> #define pause system("pause") #define SIZE …

Member Avatar for Moschops
0
131
Member Avatar for totalwar235

I was attempting to recreate the fibonacci sequence and I made a working code but my code will refuse to use a number above 12. any ideas what is wrong? #include <stdio.h> #include <stdlib.h> int main() { const int user = 1; long int fib[user]; int i = 0; int …

Member Avatar for deceptikon
0
176

The End.