Thread: how does http: working in C program

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    1

    how does http: working in C program

    Hi Guys,

    i just found that the word http: is working fine in my C Program without giving any error.

    writing a program for your reference.
    Code:
    #include<stdio.h> 
    #include<conio.h> 
    void main()
    {
    http:
    clrscr();
    printf("http is working fine");
    getch();
    }
    Please do suggest why this is not giving any error.
    Last edited by Salem; 11-08-2010 at 11:10 AM. Reason: Added [code][/code] tags - for the fat lot of good that it did

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    First of all main should be int main(void) and return 0 at the end.

    Secondly, I suspect that is a label for a goto statement, it is not a keyword of the language.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by claudiu View Post
    First of all main should be int main(void) and return 0 at the end.

    Secondly, I suspect that is a label for a goto statement, it is not a keyword of the language.
    Yep... that's what it is... a label.

    Now, lets put in int *ftp as a variable... You could write...
    Code:
    if (!ftp)
      goto http;

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Holy crap...all I have to do to use http is add http: to my code? After all this time working with cURL, I feel cheated!

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by rags_to_riches View Post
    Holy crap...all I have to do to use http is add http: to my code? After all this time working with cURL, I feel cheated!
    Nobody ever said life would be fair...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Working Through book, need help with a program
    By envie in forum C Programming
    Replies: 2
    Last Post: 11-23-2009, 01:58 AM
  2. Program stopping working
    By SterlingM in forum C++ Programming
    Replies: 24
    Last Post: 10-17-2009, 02:38 PM
  3. Program not working right
    By blindman858 in forum C++ Programming
    Replies: 3
    Last Post: 04-17-2005, 09:37 AM
  4. Program not working
    By jat421 in forum C Programming
    Replies: 6
    Last Post: 03-20-2005, 08:28 PM
  5. Program ive been working on called ChatMate
    By dirkduck in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-23-2002, 09:05 PM

Tags for this Thread