File I/O problem

This is a discussion on File I/O problem within the C Programming forums, part of the General Programming Boards category; I've got a question. I'm writing a driver for a fiscal printer. The data I need to print is in ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    3

    File I/O problem

    I've got a question. I'm writing a driver for a fiscal printer. The data I need to print is in a text file. It's just a bunch of order lines that have to be printed. Is there a function that will check the file and tell me how many lines are in it? This would help me a lot. I need to know how many lines are in this file before I can enter transaction mode.

    If there is no function like this, my other idea was to use a linked list. Just read all the data into a linked list and every time I reach the end of a line, increment a counter. This would be a worse solution than the previous one. Thanks

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    I'm afraid your going to have to do it yourself. You could write a function that searches through the file for new line characters and increments a variable, or you might as well read in the data at the same time and use your linked list idea. Ease over efficiency?
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File i/o problem
    By tezcatlipooca in forum C++ Programming
    Replies: 18
    Last Post: 01-01-2007, 08:01 AM
  2. File I/O problem
    By Onions in forum C++ Programming
    Replies: 41
    Last Post: 02-24-2006, 03:32 PM
  3. File I/O problem
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 12
    Last Post: 09-03-2005, 12:14 PM
  4. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM

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