Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9234649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:50:23+00:00 2026-06-18T06:50:23+00:00

I have written this little parser that reads in some numbers from text file.

  • 0

I have written this little parser that reads in some numbers from text file.

    data.resize(7,datapoints); //Eigen::Matrix<float,7,-1> & data
    dst = data.data();

    while( fgets(buf,255,fp) != 0 && i/7 < datapoints)
    {

        int n = sscanf(buf,"%f \t%f \t%f \t%f \t%f \t%f \t%f",dst+i++, dst+i++,dst+i++,dst+i++,dst+i++,dst+i++,dst+i++);
            i = i - 7 * (n<=0);
    }
    fclose(fp);
    return !(datapoints == i/7);

The thing is, when i do a std::cout on the data it flipped.

Data in:

0   4   0.35763609  0.64077979  0   0   1
0   4   0.36267641  0.68243247  1   0   2
0   4   0.37477320  0.72945964  2   1   3

data.col(3) is

0.64077979  
0.68243247  
0.72945964 

and data.col(4) is

0.35763609  
0.36267641  
0.37477320 

I cant see the logic why it have flipped the data horizontal?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:50:25+00:00Added an answer on June 18, 2026 at 6:50 am

    To illustrate the problem:

    #include <cstdio>
    
    void f(int i, int j, int k)
    {
      printf("i = %d\tj = %d\tk = %d\n", i, j, k);
    }
    
    int main()
    {
      int i=0;
      f(i++, i++, i++);
    }
    

    Executing this, returns here (g++ 4.3.4 on Cygwin):

    i = 2   j = 1   k = 0
    

    The execution order of the i++ calls inside the function call is entirely implementation defined (i.e. arbitrary).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little problem with printing data like this, I have written script like
I have written this little weird piece of code. How is this possible that
I have written a little program that deletes a record from the database using
I have written this little script to find executables that are passed as arguments
I have written a little bash script that reads commands (one per line), in
have written this little class, which generates a UUID every time an object of
I have written this code inside a servlet to delete certain records from three
I have written this function to auto correct gender to M or F from
I have written this program, which sorts some ints using a functor: #include<iostream> #include<list>
I have two tables that look a little like this AGR_TERR_DEF_TERRS ID DEF_ID TERRITORY_ID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.