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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:34:26+00:00 2026-05-24T05:34:26+00:00

I am working on a project where I intend on connecting to a database,

  • 0

I am working on a project where I intend on connecting to a database, grabbing a .csv file, reading it, manipulating the data and then returning it back to the database. Fairly simple and straight forward but I am still learning so if any one could point me in the right direction I would greatly appreciate it. Right now I have a simple program that is trying to read a .csv file and return the values to me printed on the console. I have been trying to find some good online resources for this but have came up short. Here is my code for what I have stumbled through so far.

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main ()
{

int loop = 1;

while(loop = 1)
{

cout << "Welcome! " << endl;

ifstream myfile;

myfile.open ("..\\ Source\External\\ Sample.csv", ifstream::in);

The real path to this file is C:\Documents and Settings\RHatfield\My Documents\C++\Product Catalog Creator\Source\External\Sample.csv

while (myfile.good())
cout << (char) myfile.get();

myfile.close();
system("PAUSE");

return 0;
}


}

Now the issue is it does not print the values so I do not know that they are properly being captured. I have a feeling it is my file path but that’s the only way I can find to write it without it throwing errors. I think it’s something with the spaces in the file path but I can’t seem to find another way to make it work. I am not looking for a handout and this is not homework or just regular work. I am trying to learn and having trouble teaching myself so if someone knows what the issue is and can help me fix it or even point me to a relevant article online would be greatly appreciated.

  • 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-24T05:34:27+00:00Added an answer on May 24, 2026 at 5:34 am

    Try the following code. I think the problem was you were making an assignment statement in the while condition statement.

    #include <iostream>
    #include <fstream>
    #include <string>
    
    using namespace std;
    
    int main ()
    {
       cout << "Welcome! " << endl;
    
       ifstream myfile;
    
       myfile.open ("C:\\Documents and Settings\\RHatfield\\My Documents\\C++\\Product Catalog Creator\\Source\\External\\Sample.csv", ifstream::in);
       while (myfile.good())
          cout << (char) myfile.get();
    
       myfile.close();
       system("PAUSE");
    
       return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While working a project tonight, I ended up using one .js resource file for
I am working on project -online file management where we have to tore file
In a windows project I am working on, I intend to have a menu
I'm working on a C++ project that I don't intend to develop or deploy
I'm working on a project that uses Hibernate and MySQL. I intend to use
I'm currently working on a project which will support multiple file writing specifications (imagine
I'm working on a personal project focusing on analysis of text in a database.
I working on project and have problem with threading and update of UI. I
I am working a project where I need to generate a series of classes
I'm currently working on project with Haskell, and have found myself some trouble. I'm

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.