The number of digits in each row is uncertain due to the issue that the MFC file reads txt. 50

Updated on technology 2024-05-03
21 answers
  1. Anonymous users2024-02-08

    Loop reads. cstring str, strcnt, strtemp;

    int num= 0;

    double dat[10];

    if(strline!="")

    while( true )

    str= " ");

    strline=

    if(str!="")

    if(strline=="")

    break;

    Number of digits: %d. They are:", num);

    for (int n= 0; n< num; n++)"%lf ", dat[n]);

    strcnt+= strtemp;

    messagebox(strcnt);

  2. Anonymous users2024-02-07

    The size of the txt file is a character, so it needs to be converted to double data after reading before it can be saved.

    ptrarray is the storage address, and when you need to store the data address of each double type, you can save the address where the data is saved. You may ask, that in **Get data address. The answer is that every time the data is read, first open up memory for each data in the memory, generally allocate it with new, save the data to this memory, and put it.

    The address obtained from new can be saved to the ptrarray.

  3. Anonymous users2024-02-06

    Define carraym name directly;

    Just read it out and exist inside.

  4. Anonymous users2024-02-05

    if (!

    getline(infile, buf);

    stringstream(buf)>>node;

    vac[i].push_back(node);

    If becomes while.

    while(!

    infile>> buf;

    stringstream(buf)> grinding trail take" state cheats node;

    vac[i].push_back(node);

  5. Anonymous users2024-02-04

    Step 1: Read the data line by line;

    Step 2: Process each row of data and obtain the data of each row according to the data separator.

    That's it.

  6. Anonymous users2024-02-03

    //#include ""vc++ plus this line.

    #include ""

    #include ""

    void main(void)

    rewind(fp);The file pointer has been moved to the beginning....Go to Follow-up Operations}

  7. Anonymous users2024-02-02

    Since there is 1-digit data and 4-digit data, it is impossible to determine the number of rows and columns if there is no deliberate carriage return in txt. If there is a carriage return, it is simple and uses.

    #include

    char *strtok( char *str1, const char *str2 );

    can be solved. Read a str out of one row with getline() and add up the number of rows, then.

    char *result = null;

    char string[100][100];

    int x = 0;

    result = strtok( str, " ");

    while( result != null )

    This allows you to store all the data with a string array. x records the total, and then x divides by the number of rows to get the number of columns.

    I'm free today, so I'll help you write all the programs:

    #include

    #include

    #include

    using namespace std;

    void main()

    memset(ch,0,100);

    } Already run, no problem, b[100][100] is all elements, x is the number of rows, y x is the number of columns.

  8. Anonymous users2024-02-01

    1. Establish a pointer;

    2. Open the file.

    3. Loop reading each time to read the line break as the end, the read data is separated by a space, see how much data there is, apply for a pointer that can put down the data, and put its content in;

    4. At the end of the reading, close the file.

    Pointer structure per line:

    struct line

    where *data=(int * malloc(sizeof(int)* len).

    I won't write about it!

  9. Anonymous users2024-01-31

    The array dimension is set to be large enough.

    Or just use a vector container.

    Or use a singly linked list in a data structure.

  10. Anonymous users2024-01-30

    Can you elaborate a little bit more?

  11. Anonymous users2024-01-29

    Is the format fixed? If it is fixed, after removing the first character of each line, read 7 characters at a time, load them into the buffer, then take the middle 5, and then take the left and right 2 each.

  12. Anonymous users2024-01-28

    You know the content in txt, and there is a certain pattern, you can seek the pointer to the place where there is a value, and then read it out; If you don't know the content of txt, you have to read it out first and then determine if it's a value.

  13. Anonymous users2024-01-27

    It is recommended to read a line first, and then match one character at a time, that is, find it first (the following is the number to start, and then to find, and the front is the number, and then to find).

  14. Anonymous users2024-01-26

    For fixed-format content, it is recommended to use file serialization to read in, so you don't have to worry about file operation.

  15. Anonymous users2024-01-25

    getbuff reads hit), converts the read string into numbers.

  16. Anonymous users2024-01-24

    Read line by line, just take each parenthesis and save it.

  17. Anonymous users2024-01-23

    #include

    I have the txt file and the contents are:

    struct data;

    Parse a line.

    bool parseline(data& data, char *buff)

    return sscanf(buff, "%d %d %d %d %d %d %d", returns true if successful, reads the file to pdata, and returns the number of records in nretnum.

    bool readtxt(data* pdata, int& nretnum, const char* pszfilename)

    fclose(fp);

    return true;

    Test the data that is being read.

    void showdata(const data* pdata, int num)

    void main()

  18. Anonymous users2024-01-22

    It is possible to loop and then end the input with a specific symbol, and a set to hold the entered numbers. **Examples are as follows:

    import ;

    import ;

    import ;

    public class test else} output collection.

    The number you entered is:");

    for (int i = 0; i < i++)

  19. Anonymous users2024-01-21

    Entering an indeterminate number should make the last one entered be a judgment character, which means that the entry of a certain character ends, and the character is preceded by the score you need.

  20. Anonymous users2024-01-20

    Stipulate a closing character, such as receiving "0" to end acceptance.

  21. Anonymous users2024-01-19

    Can you elaborate on that?

Related questions
7 answers2024-05-03

The reading is correct, but the display of MATLAB only shows four decimal places, you can see the exact value by copying the data read into the workspace in MATLAB into XLS.

8 answers2024-05-03

Let's give you a method.,This method is set up.,You can change it to read.,If you can read the configuration, it's no problem, right? >>>More

14 answers2024-05-03

dim x as long 'New.

get #1, ,r2 'Read the record of R2 from the first point in channel 1; get 1, 2, r2 read the 2nd record of r2 from inside channel 1. >>>More

7 answers2024-05-03

Check if the file exists.

9 answers2024-05-03

I think it works, I did it once when I first started working, and I don't remember it very well, but you can try it with the seek function, locate it first, read it later, and I remember when I was doing this, I read the book The C Programmer, which is about 234 pages.