Thread: Help reading a file

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    39

    Exclamation Help reading a file

    Hi,

    I Have a text file which has a lot of lines,I want to extract the first 3 lines of the file(Which are integers) and assign them to 3 different int variables, and from the 4th line i need to put the values all the way till the end of the file in to an array.

    I dunno hoe to do it using fscanf i.e how to keep track of how many lines of the file has the program navigated and how to assign the values of the file based on the line to different variables. please help?

  2. #2

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> please help?

    Post the code you're working with.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Registered User
    Join Date
    Jun 2009
    Posts
    8
    Follow Spidey's suggestion...one tip I will give you is the atoi function which takes in a string like "32" and converts it to the int 32.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  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. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM