473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why doesn't my ifstream object work?

Hello. I need to open multiple (text) files one by one and I thought to generate their names and use the streams to read from them.

Expand|Select|Wrap|Line Numbers
  1. const char* FIN = FileName.c_str();
  2. ifstream fin(FIN, ios::in | ios::binary );
  3.  
"FileName" is a string (not char[], string) and is generated manually. To read from file I used the extraction operator >> but it just doesn't read. and in the debugger, at the "watch variables" window it says <incomplete type> for the fin object.

What more should I add?
Jan 6 '11 #1
2 1967
horace1
1,510 Expert 1GB
are you sure that the file opens correctly, e.g. using a try {} catch {} structure and printing any message from the catch?
Jan 6 '11 #2
well, I had a little mistake in generating the filename. I forgot to add the extension. I only generated "file1" and I forgot to append ".txt" to it. Sorry for bothering!
Jan 6 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RIP | last post by:
i posted earlier, and the response seemed to be there is another dll i need to use the cdonts object, i used it fine for awhile on my old setup, i upgraded to 2k3 and it errors up as if cdonts...
4
by: Dennis M. Marks | last post by:
I changed my home page to use <object> rather that <iframe> for an inset scrolling window. It works on my Mac using IE and Netscape. I would like to know if it works in Opera, AOL, and Mozilla and...
6
by: csvka | last post by:
Hello, I wonder if I could pick your brains. I'm beginning to learn about C++. I have opened a file in my program and I want to read lines from it. I would like this to be done in a separate...
0
by: google | last post by:
I am trying to write to a dba and the result is creating a database file, but not writing anything to it. The relevant function is being called, and my variables are populated, but the database...
5
by: Showjumper | last post by:
I cannot get the custom Tag Prefix to work in controls made w/ VBNET. Why??? It works just fine in controls made w/ c#. Is vbnet just buggy?
6
by: Richard | last post by:
Hi, I write mostly winform app and often create a Business Class Library for my bus logic. When doing this I often set the method to static so I don't need to instantiate the class. Can I do...
9
by: xmlhelp | last post by:
stuff.XSL: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="uid"/> <xsl:template match="/"> parameter...
6
by: Arun Nair | last post by:
import string class Card: # Not sure if I need to set these first??? # suitList = () # rankList = () def __init__(self,suit,rank): self.suit = suit
1
bajajv
by: bajajv | last post by:
Hi, How to release an ifstream or ofstream object before it goes out of scope?
4
by: supriyamk | last post by:
Hi, i am trying to copy files of a certain type into a different directory using perl, The copy function doesnt seem to work. my @dir_list; my $sub_dir; my $file_name1; ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.