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 5956935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:19:44+00:00 2026-05-22T18:19:44+00:00

I am reading a file like: 31 0A 34 0A 31 0A 38 0A

  • 0

I am reading a file like:

31 0A 34 0A 31 0A 38 0A 34 0A 33 0A 36
0A 31 0A 31 0A 39 0A 31 30 0A 31 30 0A
35 0A 35 0A 31 30 0A 31 0A 33 0A 36 0A
33 0A 31 30 0A 35 0A 31 0A 31 30 0A 39
0A 35 0A 38 0A 33 0A 36 0A 34 0A 33 0A
36 0A 35 0A 31 30 0A 37 0A 32 0A 36 0A
33 0A 36 0A 35 0A 31 30 0A 37 0A 39 0A
33 0A 36 0A 32 0A 36 0A 35 0A 34 0A
0A
30 20 31 20 34 37 32 37 0A 30 20
33 20 36 33 36 33 0A 30 20 34 20 33 36
35 37 0A 30 20 35 20 33 31 33 30 0A 30
20 36 20 32 34 31 34 0A 30

I am planning to reading The first part of the file with the following code, until to find the sequence 0A 0A:

readed = fscanf(f,"%s", str_aux); 

After 0A 0A I need to read with the following sentence:

readed = fscanf(f,"%s %s %s", str_aux1, str_aux3, str_aux3);

How i could detect the 0A 0A in order to start reading the second part of the file.

I would like to use the following structure:

while (something){

   readed = fscanf(f,"%s", str_aux);
}

while (fscanf(f, "%s %s %s", a,b,c)!= EOF){

...
...
}

some idea for something condition (inside the first while)?

I’m working on Linux.

  • 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-05-22T18:19:44+00:00Added an answer on May 22, 2026 at 6:19 pm

    If you insist on using fscanf, you can read one character at a time. For example,

    
    int nl_count = 0;
    char current;
    while(nl_count < 2)
    {
        readed = fscanf(f,"%c",&current);
        /* check that readed == 1, throw error otherwise */
        if(current == 0x0A)
            nl_count++;
        else
            nl_count = 0;
    }
    

    I think this will do exactly what you want. This reads one character at a time until two consecutive 0x0A’s (newlines) occur. Then the loop breaks and you can go on to the second while loop.

    I’ll agree with Seth, however, that fgets or fgetc would be more appropriate for the first loop.

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

Sidebar

Related Questions

With the following file reading code: using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read,
After reading some posts like this one: Choose File Dialog It appears that Android
I am reading file contents in perl by following code my @files = glob($PATH/*);
I have a perl script that's reading an INI file like this: [placeholder_title] Hostname
I am reading a CSV file and I would like to cache the results
I'd like to open the same file for both reading and writing. The file
I will be passing the xml file like this: File1.PostedFile.InputStream //reading xml file..... public
I'm reading an html file like this: try { BufferedReader bufferReader = new BufferedReader(new
So I'm reading in a file (like java program < trace.dat) which looks something
I'm using a CSV dataset config element, which is reading from a file like

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.