Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
QuesTMajoR

Read a Multiple Words in one line Turbo C++/C

Recommended Posts

Hello guys, I need this for my School Project.

I need to store sentence in a text file [iVE ALREADY DONE THIS]

But I need to load in from a textfile and store it on a variable so i could print it.

 

FOR EXAMPLE:

 

Enter Book Name: Fifty Shades of Grey [THIS INCLUDES SPACES]

 

Then save it on a text file.

 

AFTER THAT

 

Would you like to load the title? [Y/N] [Entered Y]

I need to print the whole sentence Fifty Shades of Grey

 

But all that happened was only the word "Fifty" was printed

 

And I need to store Fifty Shades of Grey into a variable so that I can append it to the new inputs, not to overwrite it.

 

 

I NEED A QUICK FEEDBACK GUYS, the deadline is close.

 

Thanks in advance :)

Edited by QuesTMajoR

Share this post


Link to post
Share on other sites

Hai!

 

I myself have little to no clue on how to work with C++ or C since I primarily work with Java based codes, however a quick search online resulted in this. 
http://stackoverflow.com/questions/7868936/read-file-line-by-line or if that is not what you are looking for 
http://stackoverflow.com/questions/13035674/how-to-read-line-by-line-or-a-whole-text-file-at-once this should be what you are looking for.

 

If you are unable to use sites like these for your schooling, that is unfortunate :(. Stack overflow is one of the best question answer sites for any coding language.

Things to check, Did it store all of the string to the file? 'fifty shades of grey'

Can you please post a little bit of the processing code here so that we can analyze it?

Does your loop cancel once it sees a space? so that it results with only 'Fifty'

That is all I could think of to help you as of now,

 Good Luck!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...