| | |
help with some error codes please.
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2007
Posts: 11
Reputation:
Solved Threads: 0
Hi all,
Am fairly new to the programming world, but am kind of struggling along. I have written a piece of code for a client program with has given me some errors that i just can't see when compiling. The errors listed are :
And i have also listed the program below. I hope that someone can point out the errors in my ways. Thanks in advance for looking.
Am fairly new to the programming world, but am kind of struggling along. I have written a piece of code for a client program with has given me some errors that i just can't see when compiling. The errors listed are :
C Syntax (Toggle Plain Text)
client.c: In function `main': client.c:118: error: syntax error before '-' token client.c: At top level: client.c:132: error: conflicting types for `close_socket' sockets.c.h:40: error: previous declaration of `close_socket' client.c:133: error: parse error before '}' token
And i have also listed the program below. I hope that someone can point out the errors in my ways. Thanks in advance for looking.
C Syntax (Toggle Plain Text)
; char box[5]; char ack[50]; int boxlenerr; char view_data[256]; printf("client ...\n"); printf("please enter host server name\n"); scanf("%s",server); printf("please enter server port number\n"); scanf("%d",&port); /* remember the "&" to allow scanf to store the input value */ local_socket = create_socket(); printf("client: socket %d created\n", local_socket); ok=connect_sockets(local_socket, server, port); /* socket is connected at this point */ printf("Please enter your SetTopBox Number\t"); scanf("%s",box); if (strlen(box) !=10) { printf("Incorrect box number, please try again later\n"); } else { send_data(local_socket,box,strlen(box)+1); recv_data(local_socket,ack); } printf("Please enter your Customer ID\t"); scanf("%s",id); if (strlen(id) !=4) { printf("Your ID number needs to be 4 digits long\n"); } else { send_data(local_socket,id,strlen(id)+1); recv_data(local_socket,ack); } int option; option = 0; printf("NuTV SELECTION MENU"); while (option !=4) { display_menu(); option = get_selection(); switch (option) { case 1: get_prog_ch(); break; case 2 : get_prog_cat(); break; case 3 : get_prog_sub(); break; } } printf(" Thanks for calling Goodbye\n\n"); if (ok < 0) { printf("failed to connect sockets\n"); } else { printf("client: connection made to server, now use service\n"); len=recv_data(local_socket,data); printf("client: %d bytes of data received\n",len); /* now display the data received, character by character */ for (i=0;i<len;i++) { printf("%c",data[i]); } printf("\n"); } void display_menu() { printf("\n"); printf("Please choose an option\n"); printf("1-Choose programmes by channel number\n"); printf("2-Choose programmes by category\n"); printf("3-Choose programmes bt ctegory & sub-categroy\n"); printf("4- Exit the system\n"); } int get_selection() { int ch =0; while (ch >3 && ch <1) {printf("please enter your choice (1-3) and press return:\n"); scanf("%d",&ch); } return (ch); } void get_prog-ch() { printf(" this gets you the channels"); } void get_prog_cat() { printf(" By category"); } void get_prog_sub() { printf("By sub category"); } }
Last edited by Ancient Dragon; Apr 19th, 2007 at 9:15 am. Reason: corrected code tags
![]() |
Similar Threads
- error codes and blue screen (Troubleshooting Dead Machines)
- Random Crashing followed by a blue screen- Kernel Data Error and Hardrive Failure (Troubleshooting Dead Machines)
- Memory Error Opening And Closing Help (Viruses, Spyware and other Nasties)
- PC error: cant start in safe mode (Windows NT / 2000 / XP)
- DNS ERROR>>>CANNOT CONNECT TO SECURE SITES (Viruses, Spyware and other Nasties)
- runtime error#58 (Visual Basic 4 / 5 / 6)
- "Error message when starting Microsoft Word" (Viruses, Spyware and other Nasties)
- Error message when reading floppy in windows xp pro and dos boot (Storage)
Other Threads in the C Forum
- Previous Thread: string manipulation
- Next Thread: strcmp doesn't work... =(
Views: 962 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays bash binarysearch changingto char character cm copyanyfile copypdffile createprocess() database directory drawing dynamic execv feet fgets file floatingpointvalidation fork framework function functions getlogicaldrivestrin givemetehcodez global grade graphics gtkwinlinux histogram homework i/o ide include infiniteloop initialization input interest intmain() iso keyboard kilometer lazy license linked linkedlist linux list looping loopinsideloop. lowest matrix meter microsoft mqqueue mysql oddnumber odf open openwebfoundation overwrite pause pdf pointer pointers posix power process program programming pyramidusingturboccodes read recursion recv recvblocked reversing segmentationfault single socket socketprogramming spoonfeeding standard strchr string student suggestions system test testing threads unix urboc user whythiscodecausesegmentationfault win32api windowsapi






