User Profile

Collapse

Profile Sidebar

Collapse
crochunter
crochunter
Last Activity: Oct 22 '09, 07:00 PM
Joined: May 20 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • crochunter
    replied to Mulltimap multiple file output
    in C
    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
    See more | Go to post

    Leave a comment:


  • crochunter
    started a topic Mulltimap multiple file output
    in C

    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 :(...
    See more | Go to post

  • crochunter
    replied to Counting rows and colums in a flat file
    in C
    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

    ...
    See more | Go to post

    Leave a comment:


  • crochunter
    replied to Counting rows and colums in a flat file
    in C
    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 );
    ...
    See more | Go to post

    Leave a comment:


  • crochunter
    replied to Counting rows and colums in a flat file
    in C
    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);
    }
    ...
    See more | Go to post

    Leave a comment:


  • crochunter
    started a topic Counting rows and colums in a flat file
    in C

    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
    ...
    See more | Go to post

  • crochunter
    replied to Playing with Multimap
    in C
    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));
    ...
    See more | Go to post

    Leave a comment:


  • crochunter
    replied to Playing with Multimap
    in C
    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));
    ...
    See more | Go to post

    Leave a comment:


  • crochunter
    replied to Playing with Multimap
    in C
    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..

    Thanks
    See more | Go to post

    Leave a comment:


  • crochunter
    started a topic Playing with Multimap
    in C

    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:
    Code:
    Johnson, J. 12345
    Smith, P. 54321
    OR I want to print only the last values like this:-
    Code:
    Johnson, J. 10000
    Smith, P. 60000
    How can I do this ?
    Here is what I have till now.

    Code:
    typedef multimap <char*, long, compare>
    ...
    See more | Go to post

  • crochunter
    replied to Constructor issue
    in Java
    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);
    ...
    See more | Go to post

    Leave a comment:


  • crochunter
    replied to Constructor issue
    in Java
    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.

    Thanks
    See more | Go to post

    Leave a comment:


  • crochunter
    replied to Constructor issue
    in Java
    Most important am I calling the method correctly ? in the constructor ?
    Code:
    ReadFile(filename, value11, value2);
    Thanks
    See more | Go to post

    Leave a comment:


  • crochunter
    replied to Constructor issue
    in Java
    Let me try

    so using "throws BarException" will solve my problem ? Let me try

    Thanks
    See more | Go to post

    Leave a comment:


  • crochunter
    replied to Constructor issue
    in Java
    Will this work ?

    If I create a method like
    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));
     ............................................  
     }
    Now if I...
    See more | Go to post

    Leave a comment:


  • crochunter
    started a topic Constructor issue
    in Java

    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
    ...
    See more | Go to post

  • crochunter
    replied to Help in Swing
    in Java
    Hi

    Thanks. Plz do send me some other useful links if u think they will help me.
    See more | Go to post

    Leave a comment:


  • crochunter
    started a topic Help in Swing
    in Java

    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...
    See more | Go to post

  • No

    No why ? I was curious to know how for loop will work in this case.

    Thanks
    See more | Go to post

    Leave 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;
    ...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...