19,876 Topics

Member Avatar for
Member Avatar for sassy_94

while(1){ new=accept(socket, (struct sockaddr*)&peer_addr,&peer_addrlen); if (new<0){ break; } else{ recv(new,mesg,sizeof(mesg),0); if (strstr(mesg, "GET") != NULL){ printf("\n%s",mesg); FILE *write = fdopen(new, "w"); fprintf(write, "HTTP/1.1 200 OK\nContent-length: 47\nContent-Type: text/html\n\n<html><body>< H1>HTTP/1.1 200 OK</H1></body></html>"); fflush(write); } else if (strstr(mesg, "POST") != NULL){ strcpy(resp,"POST\nContent-length: 47\nContent-Type: text/html\n\n<html><body><H1>POST</H1></body></html>"); c=send(new,&resp,sizeof(resp),0); printf("%c",c); } else{ strcpy(resp,"HTTP/1.1 500 Server Interval Error\nContent-length: …

Member Avatar for rubberman
0
276
Member Avatar for anar.bataa

i have a text file like this: # Nmap 6.40 scan initiated Tue Dec 24 05:42:34 2013 as: nmap --open -oN 123.txt 10.0.5.0/24 Nmap scan report for 10.0.5.1 Host is up (0.63s latency). Not shown: 992 closed ports, 6 filtered ports PORT STATE SERVICE 22/tcp open ssh 443/tcp open https …

Member Avatar for rubberman
0
213
Member Avatar for abousetta

How To Implement Using Double Linked List Structure in C++ function DisplayEven(...) that displays only the even elements inserted by the user.

Member Avatar for maheshd13
0
193
Member Avatar for abousetta

How To Implement Using Double Linked List Structure in C++ function DisplayEven(...) that displays only the even elements inserted by the user.

Member Avatar for tinstaafl
0
68
Member Avatar for johans22

#include <stdio.h> static int Var1; static FUNC() { //do stuff with var } void CALL_FUNC() { //call FUNC //do stuff } void fc1(void) { CALL_FUNC(); } void fc2(void) { CALL_FUNC(); } void fc3(void) { CALL_FUNC(); } //etc. void main() { } goal is to break the fc1, fc2 and others …

Member Avatar for johans22
0
196
Member Avatar for kent.johnstone_1

I need some pointers with pointers. What is the difference between a variable preceded by an "*" and an "&"? Some of my sample code uses one and some the other. I'm getting compiler errors trying both saying the variable is not defined. First use this function.

Member Avatar for kent.johnstone_1
0
423
Member Avatar for Pia_1

I have a problem with registering a new employee for my project. It can only detect the first employeeID as an existing.. Here's my code: void registerNewEmployee(){ FILE *fp; struct employee obj; fp=fopen("data.txt","a+"); system("cls"); printf("\n\t*******************************************"); printf("\n\t*******************************************"); printf("\n\t***\t\t\t\t\t***"); printf("\n\t***\tNEW EMPLOYEE REGISTRATION\t***"); printf("\n\t***\t\t\t\t\t***"); printf("\n\t*******************************************"); printf("\n\t*******************************************\n\n"); char employeeIDNew[5]; printf("Employee Number: "); scanf("%s", &employeeIDNew); …

Member Avatar for deceptikon
0
203
Member Avatar for mohammed.alaa.56808
Member Avatar for vegaseat

This is an example of a singly linked list allowing you to enter a number of names and associated ages. The twist is that the names are inserted into the list in ascending order. When the list is displayed, it is already sorted by name. Note: This is not an …

Member Avatar for Ancient Dragon
1
470
Member Avatar for Pia_1

I have attached data.txt file with contains all of the employees data. The problem is when I login, it would only read one record. Here's my code: #include <stdio.h> #include <conio.h> #include <string.h> #include <stdlib.h> int login(); void displayWelcome(); main(){ int result; do{ system("cls"); result = login(); if(result==1 || result==2){ …

Member Avatar for dev90
0
198
Member Avatar for kent.johnstone_1

What does -> mean in the following line of code? bulk_in=end_point->bEndpointAddress; My books show - and > but neither of them seem to apply. The books don't seem to show both together. This is part of a USB driver that I'm trying to convert from Linux to C for the …

Member Avatar for kent.johnstone_1
1
246
Member Avatar for inspire_all

Problem: input:square matrix of order n and a query which will denote the submatrix.(x1,y1,x2,y2) output:no of distinct elements in this submatrix. constraint:time limit=1 sec this is what i tried #include<stdio.h> //#include<conio.h> int main() { //clrscr(); int a[300][300],test[100000],count[10],m,n,c,j,p,q,r,s; long qu,re,i; scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); scanf("%ld",&qu); for(re=0;re<qu;re++) { c=0; for(i=0;i<10;i++) count[i]=0; scanf("%d …

0
81
Member Avatar for Fedoros
Member Avatar for iness.popovcic

#include <stdio.h> #include <conio.h> main() { int i,j,k,l,m,n; printf("Put in n nober of sqeur: "); scanf("%d",&n); printf("Whit wich nomber do you wanna start your squer?: "); scanf("%d",&m); for(j=m;j<=n+1;j++) { for(k=j;k<=n;k++) { printf(" %d",k); } for(l=1;l<j;l++) { printf(" %d",l); } printf("n"); } getch(); } Editor's note: moved to the appropriate forum

Member Avatar for 2teez
0
109
Member Avatar for Wael1988

**hello folks, i am new programmer,,,i have studied C# , Asp.net , Ado.net,SQL , Sharepoint Adminstration and development! but i am still junior..i mean i still ddnt get a job!! sumtimes i feel that its hard to go on programming..like i do always study but always forget..i feel sumties like …

Member Avatar for Wael1988
0
203
Member Avatar for beyn
Member Avatar for hemanshurpatel

Hi friends, I want to implement code which can take input from some other application. Like say for example ls | less Here, less is the application/utility which takes input from ls via pipe. I want to implement the same in C. I Did following things 1. Created PIPES using …

Member Avatar for Tumlee
0
716
Member Avatar for MisterGlow

I am student just finished an introductory class on C++. Can any one help me build a GUI for my programs? Maybe a template? Example? Any and all help would be greatly appreciated. Thanks.

Member Avatar for mrnutty
0
182
Member Avatar for eriekasato

Write a method named CustomerCreditLimit() that accepts a double as a parameter and displays the value as the amount of credit granted to a customer. Provide a default value for the method so that if a program calls the method without using an argument, the credit limit displays $500. Write …

Member Avatar for tinstaafl
0
419
Member Avatar for roshan.parate.73
Member Avatar for L7Sqr
0
778
Member Avatar for ArnoldRich
Member Avatar for ArnoldRich
0
180
Member Avatar for Bilal93

int rad; int rad; float PI = 3.14 ,area,ci; printf("\n Enter radius of a circle:"); scanf("%d",&rad); area = PI*rad*rad; printf("\narea of a circle is %f",area); ci = 2*PI*rad; printf("\ncircomeference of a circle is %f",ci);

Member Avatar for vegaseat
-1
198
Member Avatar for Annettest

Hello all: I have written a function that gets data (numbers) from a text file. My function works by taking a line from the text file, discarding unnecessary symbols, and putting the numbers into a vector. Here's a snippet: // Get data from text file. Values then put into one …

Member Avatar for haider885
0
395
Member Avatar for girmanigatu
Member Avatar for Slavi
0
140
Member Avatar for deepakps

this is a small graphical program in c....which gives you a clear discription about what a graphics can do in c..(a simple one)

Member Avatar for Deepak_17
0
176
Member Avatar for centenond

hey guys ! so im learning c, got a question: so say i have a struct of students and inside the struct is name , id , fatherName, motherName. like this struct stds { int id; char name[21]; char fatherName[21]; char motherName[21]; } std[100]; suppose they are 100 stds and …

Member Avatar for centenond
0
191
Member Avatar for mariners95

I need help with transposing a matrix. I already did the transpose matrix using 2 arrays. But I can't figure out how to do it using only one array. So read a matrix and create the transpose within itself. Do I use the swap or what? Any help would be …

Member Avatar for johnnew
0
402
Member Avatar for quitare
Member Avatar for Learner010
0
131
Member Avatar for sixtorodriguez

So, I have attached my code below. It worked fine , until I introduced the part to print out what's in the input file. After I did this, it says it's completed, but I doesn't copy the content in the output file. What should I change? Thanks a lot /*Program …

Member Avatar for sixtorodriguez
0
323
Member Avatar for Pratique
Member Avatar for kent.johnstone_1

I'm getting compiler errors in all my function prototypes. The error is "error: expected '=', ',', ';', 'asm' or '__attribute__' before 'CALCOR". CALCOR is the name of the function and the prototype is just the first line of the function followed by a semicolon as Ancient Dragon said in another …

Member Avatar for kent.johnstone_1
0
252
Member Avatar for Jed_1

I've implimented this snippet of code dijkstra_shortest_paths( g, name2v[tempName1], get(&VertexProperty::predecessor, g), get(&VertexProperty::distance, g), get(&EdgeProperty::weight, g), boost::identity_property_map(), // index-map std::less<double>(), // compare std::plus<double>(), // combine std::numeric_limits<double>::infinity(), // infinity 0.0, // zero do_nothing_dijkstra_visitor(), get(&VertexProperty::color, g)); to use dijkstra's on a map created from a text file, but I have no idea how …

Member Avatar for Jed_1
0
847
Member Avatar for kent.johnstone_1

I'm already having problems understanding structs even with two books. Now I get one with "struct struct". What does that mean. This is actually part of a linux program I'm trying to convert to C for PIC processors. Also I'm getting errors in this code that should work like "unable …

Member Avatar for kent.johnstone_1
0
184
Member Avatar for Hinata_Dev

Bonjour tout le monde , Voila ma question : je prépare un TP en c qui consiste a crée un fichier input contient la taille en premier ligne et 2 matrice d'entier dans les autres lignes ex : 4 Matrice1 1235 5456 5428 2415 matrice2 8795 2514 6524 8562 le …

Member Avatar for Mouche
0
220
Member Avatar for faris.hamarshi

hello, i am trying to store a text from file into array to do some editing on it i did this void readFile(){ FILE *fp; long lSize; char *buffer; fp = fopen ( "s.txt" , "rb" ); if( !fp ) perror("s.txt"),exit(1); fseek( fp , 0L , SEEK_END); lSize = ftell( …

Member Avatar for Mouche
0
186
Member Avatar for Jed_1

Okay, so as ussual I'm having a lot of problems with a code and I need a lot of help along the way, but I'm just going to break it down into simple questions as I go. I am taking data from an input file that is a .txt that …

Member Avatar for mike_2000_17
0
919
Member Avatar for Pratique

#include<stdio.h> #include<conio.h> void main() { printf("enter number:"); scanf("%d",&n); for(i=1;i<=y;i++) { x++; } t=x; for(i=1;i<=y;i++) { t--; } y=t; getch(); }

Member Avatar for Mouche
0
349
Member Avatar for king03

ok so here is what my code does, when you click sign up it will then open a new form wherein you can create your account by putting a username and password, after that it will save your username and password to the debug folder inside bin folder. the saved …

Member Avatar for odai.khateeb
0
3K
Member Avatar for COKEDUDE

Is there a way to check the default version of C89, C90, or C99 that gcc uses to compile your programs? I tried -v and --version but they only give the actual package of gcc info.

Member Avatar for Mouche
0
431
Member Avatar for somjit{}

My assignment says : Write a program to perform following stack operations : Create a stack with item code and quantity Itemcode Quantity 111 450 112 0 113 487 114 101 115 500 116 0 117 359 and then Delete the items having quantity zero and update the stack. My …

Member Avatar for Mouche
0
294
Member Avatar for msareef

this is the question: Write a C program that will request the user to input the values for R,L,and C and plot the a graph of current ,I, against frequency . The range for the frequency axis should be automatically selected based on the resonance frequency of the circuit.

Member Avatar for Mouche
0
3K
Member Avatar for beck.muvirimi

Write down in C++ and OpenGL a code that is able to draw a polygon with the following vertex: {-0.6,-0.6; -0.6, 0.6; 0.6, 0.6; 0,6,-0.6) and rotate the polygon by 450

Member Avatar for Ancient Dragon
0
110
Member Avatar for jacobin.draks

Hello people this is very urgent! i have to make a hotel management programme and submit by tommorow, i have made the programme but it got rejected cause i used calsses for the log in. Can u people please help me by telling me another way to write a password.. …

Member Avatar for salah_saleh
0
233
Member Avatar for D33wakar
0
349
Member Avatar for inspire_all

#include<stdio.h> #include<stdlib.h> //#define MAX 10001 void quicksort(long long[],int,int); int partition(long long[],int,int); void swap(long long[],int,int); int main() { int t,k,q,i,j,qi,c,p; long long *mot,*sat,*res; //printf("Enter no of test cases"); scanf("%d",&t); for(i=0;i<t;i++) { p=0; //printf("Enter no of chefs and no of queries"); scanf("\n%d %d",&k,&q); mot=(long long*)malloc(k*sizeof(long long)); sat=(long long*)malloc(k*sizeof(long long)); res=(long long*)malloc(k*k*sizeof(long long)); …

Member Avatar for deceptikon
0
203
Member Avatar for @di007
Member Avatar for Assembly Guy
0
112
Member Avatar for @di007

What is the difference between run time errors "Stack overflow.", "Access violation writing location 0x00000000." and "Stack around the variable 'w' was corrupted."

Member Avatar for deceptikon
0
148
Member Avatar for newbie14

I have a char all[1500]; which will store each network packet. I will convert the hex value into humand readable. Finally I need to extract the url. For e.g. I have this GET /mail/ HTTP/1.1\r\n. I know I can use first to decide if the word GET and HTTP/1.1. exist …

Member Avatar for newbie14
0
143
Member Avatar for greatman05

Hello. I need to set up some pipes for a homework assignment as part of a bigger project. The issue I'm having is that the array (args) I'm using to populate the pipe arguments keeps segfaulting and I don't know why. Everything has been malloced beforehand and the faults only …

Member Avatar for greatman05
0
260
Member Avatar for vaishali.k

Write a C++ program that can take either two integers or two floating point numbers and outputs the smallest number using class, friend functions and function overloading.

Member Avatar for yazan.quraan.39
0
157

The End.