Click here to Skip to main content
13,548,460 members
Click here to Skip to main content
Add your own
alternative version


12 bookmarked
Posted 3 Mar 2000

CEQD v1.0 - Earthquake Data Downloader

, 3 Mar 2000
Rate this:
Please Sign up or sign in to vote.
A Freeware MFC class to support retrieval of recent Earthquake data from the USGS.
  • Download source files - 10 Kb
  • Introduction

    Welcome to CEQD, a freeware MFC class to support retrieval of recent Earthquake information from the USGS (United States Geological Survey) via the finger protocol.

    For detailed information about the Finger protocol, you should read RFC 1288. You can find numerous Web Servers which carry these documents by going to and look for RFC and 1288.

    The sample app provided with the code implements a very simple console app which queries for the Earthquake information and displays the results using simple printf calls.

    API Reference
    Contacting the Author


    V1.0 (18 October 1999)
    • First public release.


    • Simple and clean C++ interface.
    • The interface provided is synchronous which provides an easier programming model than using asynchronous sockets.
    • The code does not rely on the MFC socket classes. These classes have a number of shortcomings, one of which causes problems when they are used in NT services.
    • The code can be used in a console application without any problems (Again this is not the case for the MFC socket classes).
    • A configurable timeout for the connection can be set through the main class method.


    • The code internally makes use of another of the authors classes namely CFinger. Before you can compile CEQD, you will also need to download the CFinger source and copy over the finger cpp and h files into the directory where you have unzipped the CEQD code.
    • To use the class in your code simply include eqd.cpp and finger.cpp in your project and #include eqd.h in which ever of your modules needs to make calls to the class.
    • To see the class in action, have a look at the code in main in the module main.cpp.
    • Your code will need to include MFC either statically or dynamically.
    • You will need to have a functioning Winsock stack installed and correctly initialized prior to calling the GetQuakeData() method. Depending on your application, this will involve calling either WSAStartup() or AfxSocketInit() at startup of your application.
    • You will also need to have afxpriv.h and winsock.h or afxsock.h in your precompiled header. The code will work just as well in a GUI or console app. The code should also work in a multithreaded application, although it has not be explicitly tested in this scenario.

    API Reference

    The API consists of the class CQuakeData and the single public member function of the class CEQD namely GetQuakeData.


    class CQuakeData
       enum MagnitudeType
       enum LocationQuality<br>
       SYSTEMTIME      m_Time;
       float           m_Latitude;
       float           m_Longitude;
       float           m_Depth;
       MagnitudeType   m_MagType;
       float           m_Magnitude;
       LocationQuality m_Quality;
       CString         m_sComments;


    The Coordinated Universal Time of when the Earthquake took place.

    Geographic latitude of the Epicenter. North of the equator is positive, south of the equator is negative.

    Geographic longitude of the Epicenter. East of the Greenwich prime meridian is positive, west of the prime meridian is negative.

    The depth below sea level in Km of the epicenter.

    Enum of the type of magnitude as reported in m_Magnitude. This member is one of the following enums:
    • Ml: The original Richter magnitude
    • Lg: Local or regional magnitude
    • Md: Duration wave
    • Mb: Body wave
    • Ms: Surface wave
    • Mw: Moment wave

    The actual magnitude of the earthquake on the Richter Scale.

    Enum of quality of the location fix. This member is one of the following enums:
    • A: Quake location is "Good"
    • B: Quake location is "Fair"
    • C: Quake location is "Poor"
    • D: Quake Location is "Bad"
    • U: Quake Location quality has not been determined

    This is a textual Description, Normally this will be the location of the quake.

    The CQuakeData class represents the data associated with a single earthquake as returned from CEQD::GetQuakeData().


    BOOL CEQD::GetQuakeData(CArray<CQuakeData, CQuakeData&>& data, DWORD dwTimeout = 500);

    Return Value:
    If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call ::GetLastError().


    • data -- Upon successful return, this will contain an array of CQuakeData instances which represent all the most recent earthquakes which have occurred.
    • dwTimeout -- The timeout value to use in milliseconds for socket connections.

    Call this member function to perform the actual retrieval of the quake data.

    Contacting the Author

    PJ Naughter
    18 October 1999


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    PJ Naughter
    United States United States
    No Biography provided

    You may also be interested in...


    Comments and Discussions

    Generalbug/fix Pin
    Bryce2-May-01 18:10
    memberBryce2-May-01 18:10 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Terms of Use | Mobile
    Web04-2016 | 2.8.180515.1 | Last Updated 4 Mar 2000
    Article Copyright 2000 by PJ Naughter
    Everything else Copyright © CodeProject, 1999-2018
    Layout: fixed | fluid