Thread: Checking File Format

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    10

    Checking File Format

    How do I check if a text file havea required format ?

    eg. Format :
    <product number> <description> <price>

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    465
    if a file has to have a specific format such as the one you mentioned, i am assuming that you or your program are also the ones creating the file.

    in that case, you could write out a standard header that all files of this type have to have. when you read in the file, if the header fails then the file format is invalid.

    even if someone else is writing the file, if it is a text file you can require a certain header, but the only problem is all the people that are creating files of this type would need to know the format of the header.

    otherwise, the only thing you can do is read it in and hope...
    I came up with a cool phrase to put down here, but i forgot it...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  2. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  3. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  4. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM