Thread: How can I read a Hdr file?

  1. #1
    Mazerius1st
    Guest

    Exclamation How can I read a Hdr file?

    hi everyone.

    I am a newbie in c++. I have an assignment for the university.
    We have to write a program that will read an actual header file from the university's meteosat station and show the date of the file creation and the position of the sat. I was trying to do it with i/o functions but it seems that it is not working.
    Any suggestions how I can read the file?

    Hope to hear anything

    Maz.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Creation date/time is something you'll get from the OS, check your compilers documentation. What are you using anyway?

    As for reading the file, post some code and a sample of the file contents.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    What OS do you want the program to run under?

    For Windows OS, consider these Win32 API.

    GetFileAttributes()
    GetFileAttributesEx()

    Kuphryn

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    18

    Question

    Read the header file? Just add this:
    Code:
    #include <your_header_file.h>
    All functions referenced in the header file will then be usable in your .cpp file. Hopefully I'm not misunderstanding what you are asking...

    -Mark
    Language: C++
    Compiler: Borland C++
    OS: Windows NT

  5. #5
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>#include

    did you even read the post??

    he's not reading that type of file, just because he said header file. He's reading in a text file containing info on the position of a satellite.

    you need to use file i/o

    Code:
    #include <fstream>
    
    char * satPosition=new char[128]; //make bigger if you need it
    int main()
    {
    ifstream fin("c:\\whatever\\fileCreatedByStation.txt"); //initialize file handle, don't take out the double slashes, they're character escapes
    fin.getline(satPosition,127);
    fin.close();
    
    cout<<satPosition<<endl;
    delete [] satPosition;
    satPosition=NULL;
    return 0;
    }
    PHP and XML
    Let's talk about SAX

  6. #6
    Mazerius1st
    Guest
    the file has is named Metsat.hdr not metsat.txt

    and that is what it shows when you poen it with the wordpad
    ____________________
    ADMIN MESSAGE 01/22 ISSUED ON 20/01/92
    WE ARE PRESENTLY OPERATING DISSEM ßrINATION
    SCHEDULE S9108M02.YESTERDAY 19/01/92 THE
    FOLLOWING FORMATS WERE NOT DISSEMINATED
    OR WERE INTERRUPTED DURING TRANSMISSION:

    FORMAT TIME CHANNEL
    WEFA 0622 2
    WEFA 0846 2
    WEFA 2046 2
    ___________________________

    I have to make the program to read this and so the position of the meteosat.

    Anyway thanks with for code Waldo2k2


    See ya

    Maz

  7. #7
    Registered User
    Join Date
    Oct 2002
    Posts
    6
    Hi it's me again.

    The program is to be created as a C/C++ console application using visual studio .NET.

    See ya

    Maz

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 10:47 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM