Loading stuff onto the web???

This is a discussion on Loading stuff onto the web??? within the C Programming forums, part of the General Programming Boards category; I'm trying to make a program which saves a file onto a web host then reads it off the web ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    109

    Question Loading stuff onto the web (Sockets?)???

    I'm trying to make a program which saves a file onto a web host then reads it off the web host.

    For example if you had a phone book program you could add a phone number to it (this would be saved on the web.) then someone else somewhere in the world with the program would be able to use it to view that number you added.

    I hope you can Help

    Thank you
    Last edited by Granger9; 12-21-2002 at 05:55 AM.
    OS:- XP
    Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)

  2. #2
    Registered User
    Join Date
    Aug 2002
    Posts
    109
    All I want to do is have a file put on a server so that the program can access this file from the server and write the file to the server??

    I hope that helps
    OS:- XP
    Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)

  3. #3
    Registered User unixOZ's Avatar
    Join Date
    Feb 2002
    Posts
    91
    You should maybe try PHP for that

  4. #4
    Registered User
    Join Date
    Aug 2002
    Posts
    109
    I would like to do it in C and as I don't know PHP I don't fancy learning it at the moment.

    All I want is for the user to have a program on there computer which connects to a Web server then reads a file on there then the user can either view or update this file some others with the program can see it.

    I have been searching and I found SOCKETS coming up quite a lot would this help? (I don't have a clue what sockets are/do but I am reading a tutorial on it at the moment!)

    Hope you can Help
    OS:- XP
    Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)

  5. #5
    Registered User unixOZ's Avatar
    Join Date
    Feb 2002
    Posts
    91
    Sockets are behind any program that interacts with networks, so yes, you must know socket programming

  6. #6
    Registered User
    Join Date
    Aug 2002
    Posts
    109
    So if I know sockets will that slove my problem?
    OS:- XP
    Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)

  7. #7
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    If you need information about network programming, also this site may be interesting.

    http://www.cs.cf.ac.uk/Dave/C/

  8. #8
    Registered User
    Join Date
    Aug 2002
    Posts
    109
    Thanks for all the help I am now going through all the resources you lot have given me.

    One last question where can I upload this file to???
    OS:- XP
    Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)

  9. #9
    fou
    Guest
    If you only need functionality for windows the wininet functions provide an easy method to use the internet. These functions are far easier than writing your own ftp/http uploader using sockets. However sockets are portable, wininet is not.

    WinINet Functions:
    http://msdn.microsoft.com/library/en...asp?frame=true

    Code to read a file from the internet. (FTP or HTTP):
    http://support.microsoft.com/default...;en-us;q149413

    Simplest way to upload an ftp file:
    InternetOpen
    InternetConnect
    FtpPutFile

    Have Fun!

  10. #10
    Registered User
    Join Date
    Aug 2002
    Posts
    109
    I'm not intending the program to be a windows program (simply becuase I haven't found any good tutorials which teach you how to program windows stuff in C) the program will be in DOS.

    Thanks for the help everyone if you have anything at all which might be of help please add it!!!
    OS:- XP
    Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)

  11. #11
    Registered User
    Join Date
    Aug 2002
    Posts
    109
    Code:
    /*
    ** getip.c -- a hostname lookup demo
    */
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <errno.h>
    #include <netdb.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    
    int main(int argc, char *argv[])
    {
        struct hostent *h;
    
        if (argc != 2) {  // error check the command line
            fprintf(stderr,"usage: getip address\n");
            exit(1);
        }
    
        if ((h=gethostbyname(argv[1])) == NULL) {  // get the host info
            herror("gethostbyname");
            exit(1);
        }
    
        printf("Host name  : %s\n", h->h_name);
        printf("IP Address : %s\n", inet_ntoa(*((struct in_addr *)h->h_addr)));
       
       return 0;
    }
    I try and compile the above code on my computer with Dev-C++ and it comes up with the following errors:

    netdb.h: No such file or directory
    sys/socket.h: No such file or directory
    netinet/in.h: No such file or directory
    arpa/inet.h: No such file or directory

    Is this anything to do with somthing called WINSOCK??
    Can anyone please help
    Last edited by Granger9; 12-21-2002 at 05:54 AM.
    OS:- XP
    Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)

  12. #12
    ggs
    ggs is offline
    C > C++ duders ggs's Avatar
    Join Date
    Aug 2001
    Posts
    435
    www.google.com/search?q=lcc+win32

    get it, and be happy.
    .sect signature

  13. #13
    Registered User
    Join Date
    Aug 2002
    Posts
    109
    umm sorry but how is the LCC compiler going to help me solve my problem of how to load and read stuff of web servers???
    OS:- XP
    Compiler:- MSVC++ 6 or DJGPP or Dev-c++ (Mingw)

  14. #14
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    Heh, LCC probably can't help you.

    If you had read the first few pages of the tutorial you got that code from. You would see it addresses the question of how to compile socket code on windows.

    Please do not waste the forums with frivolous questions you could answer on your own if you took the 2 seconds to look.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Cargo loading system
    By kyle rull in forum C Programming
    Replies: 1
    Last Post: 04-20-2009, 01:16 PM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 02:30 PM
  3. Partial web page downloading
    By god_of_war in forum C++ Programming
    Replies: 12
    Last Post: 08-14-2006, 01:19 PM
  4. web page loading ...
    By twomers in forum C++ Programming
    Replies: 2
    Last Post: 01-21-2006, 01:42 PM
  5. Game Company Web Sites
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-17-2001, 09:32 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21