Ya thats true but as per my problem there could be any number of output files that could be generated based on my first field values. So I was thinking a way by what I can do it dynamically ?
Like using a for loop and creating output files
Like file[i].txt
Thanks
User Profile
Collapse
-
Mulltimap multiple file output
Hi.
I am trying to create multiple output files while reading a single input file. The multiple files will be created based on the value in the first field.
My set1 contains 1,2,3,2,1,3. That is Field1 values.
My multimap contains the other fields (field2 and field3).
Now what I am trying to do is to use ofstream to output multiple output files dynamically. Its just creating 1 file and duplicating records :(... -
Hi... sorry I had forgot to declare string str while posting this code :)
Yes this code complies and no error at runtime but the output is just 1 for count and rest is the same.
I wrote a separate program and it works perfectly as you had suggested using std::string::fi nd but I am not just able to make it work while reading the file :( :( and need help in that.
Here is the code that works
...Leave a comment:
-
Hi tried to do something like this but it doesn't work donno why :(
Can somebody tell me where am I doing wrong ?
Here is the code
...Code:#include<iostream> #include<fstream> #include<string> #include<sstream> #include<map> using namespace std; int main(int argc, char* argv[]) { std::string::size_type tab_pos( 0 );Leave a comment:
-
Hi... Well I am new to C++ programming so sorry if I couldn't be objective in my question.
Well am not able to get how I can get the number of columns. I know one thing that getline can help me but how I am not able to figure out. Maybe something like this may help but not sure.
...Code:int i=0 while(!myFile.eof()) { getline(myFile, str[i], '\n'); vec.push_back(i); }Leave a comment:
-
Counting rows and colums in a flat file
Hi I was trying to count rows and columns in a tab delimited flat file.
Like here in example below i should be able to detect automatically the no of rows and columns.
So I should get 5 columns and 6 rows. Something like that.
...Code:one two three four five one two three four five one two three four five one two three four five one two three four five one two three
-
Ok I am able to build a logic which does exactly how I wanted it to work but when I add more records there are some problems in flagging.
Here is and example:-
when my input is :
...Code:mymm.insert(pair<char,int>('a',50)); mymm.insert(pair<char,int>('b',100)); mymm.insert(pair<char,int>('b',150)); mymm.insert(pair<char,int>('b',200)); mymm.insert(pair<char,int>('c',250));Leave a comment:
-
Hi do you mean something like this :-
...Code:// multimap::count #include <iostream> #include <map> using namespace std; int main () { multimap<char,int> mymm; multimap<char,int>::iterator it; char c; mymm.insert(pair<char,int>('x',50)); mymm.insert(pair<char,int>('y',100)); mymm.insert(pair<char,int>('y',150));Leave a comment:
-
Thanks guys :) I am very happy to get some guidance finally :) I discussed this problem with many people but unfortunately didn't get any replies.
I will start over again and post my codes for your cross checking..
ThanksLeave a comment:
-
Playing with Multimap
Lets suppose I want to get only the first key value pair of each key.
I mean in refernce to the below example something like this:
OR I want to print only the last values like this:-Code:Johnson, J. 12345 Smith, P. 54321
How can I do this ?Code:Johnson, J. 10000 Smith, P. 60000
Here is what I have till now.
...Code:typedef multimap <char*, long, compare>
-
I am actually using a class inside a class. Can anybody point out my mistake. My code is compiling OK but when I run it. It gives me NullPointExcept ion at java.io.FileInp utStream<init>. Like this one. Need help.
The basic structure of my code is like this:-
...Code:public class Class1 extends JFrame{ public Class1(){this.somevalues setDefaultCloseOperation(EXIT_ON_CLOSE);Leave a comment:
-
I am a bit confused about howto call a method inside a constructor and how do I handle exception in this case using this example reading file. I am already using try catch inside my ReadFile method.
ThanksLeave a comment:
-
Most important am I calling the method correctly ? in the constructor ?
ThanksCode:ReadFile(filename, value11, value2);
Leave a comment:
-
Let me try
so using "throws BarException" will solve my problem ? Let me try
ThanksLeave a comment:
-
Will this work ?
If I create a method like
Now if I...Code:public void ReadFile(String filename, int Value1, int value2) { this.filename = filename; this.value1 = value1; this.value2 = value2; ......................... BufferedReader fh = new BufferedReader(new FileReader(filename)); ............................................ }Leave a comment:
-
Constructor issue
Hi,
I have fixed some parameters to my constructor but unable to make them work.
Here is my sample code:-
...Code:public MyConstructor(String filename, int value1, int value2){ this.filename = filename; this.value1 = value1; this.value2 = value2; File reading code BufferedReader fh = new BufferedReader(new -
Hi
Thanks. Plz do send me some other useful links if u think they will help me.Leave a comment:
-
Help in Swing
Hi,
I have to add a mouse over event and mouse click event in my rectangles that I draw while taking the values from an input file. Now since I am taking rectangle height and width from the input text file as well I also want to take a text value to be shown while moving a mouse over a particular rectangle from my input file. Also when user clicks on that rectangle the height and width of that particular rectangle only should be displayed... -
No
No why ? I was curious to know how for loop will work in this case.
ThanksLeave a comment:
-
Making for loop to work
Hi... Actually I donno howto make my for loop work in this case. I am taking values from the text file. Can you give some clues.
...Code:import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.io.File; import java.io.FileNotFoundException; import java.io.BufferedReader; import java.awt.*; import javax.swing.*; import java.awt.Color;
Leave a comment:
No activity results to display
Show More
Leave a comment: