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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:09:21+00:00 2026-06-04T03:09:21+00:00

In the below code i would like to also ignore the character . But

  • 0

In the below code i would like to also ignore the character ” . But after adding that in i still get “Mr_Bishop” as my output.

I have the following code:

    ifstream getfile;
    getfile.open(file,ios::in);
        char data[256];
    char *line;
    //loop till end of file                   
    while(!getfile.eof())
    {
            //get data and store to variable data
            getfile.getline(data,256,'\n');

        line = strtok(data," ”");
        while(line != NULL)
        {
            cout << line << endl;
            line = strtok(NULL," ");
        }
    }//end of while loop

my file content :

hello 7 “Mr_Bishop”
hello 10 “0913823”

Basically all i want my output to be :

hello
7
Mr_Bishop
hello
10
0913823

With this code i only get :

hello
7
"Mr_Bishop"
hello
10
"0913823"

Thanks in advance! 🙂

I realise i have made an error in the inner loop missing out the quote. But now i receive the following output :

hello
7
Mr_Bishop
�
hello
10
0913823
�

any help? thanks! 🙂

  • 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-04T03:09:22+00:00Added an answer on June 4, 2026 at 3:09 am

    Have a very careful look at your code:

        line = strtok(data," ”");
    

    Notice how the quotes lean at different angles (well mine do, I guess hopefully your font shows the same thing). You have included only the closing double quote in your strtok() call. However, Your data file has:

    hello 7 “Mr_Bishop”
    

    which has two different kinds of quotes. Make sure you’re using all the right characters, whatever “right” is for your data.

    UPDATE: Your data is probably UTF-8 encoded (that’s how you got those leaning double quotes in there) and you’re using strtok() which is completely unaware of UTF-8 encoding. So it’s probably doing the wrong thing, splitting up the multibyte UTF-8 characters, and leaving you with rubbish at the end of the line.

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

Sidebar

Related Questions

I've put together a small code-sample below (Currently in C# 3.5 but would also
I would like to implement a parallel version of the code below using threads
For the code below, I would like to append echo $_SERVER['QUERY_STRING']; to the end
I understand that the code below would result segmentation fault because at the cstr
Given the code below, how would you create/implement SR.h so that it produces the
I can't get the code below to compile (see errors). Advice on correction would
In the code below, I would like the value of THE_VERSION_STRING to be taken
if f = g + h then where in the below code would I
Consider the Java code below, what would happen if there were no paintComponent method
Any help would be appreciated, I'm trying to convert the code below to C#,

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.