User Profile

Collapse

Profile Sidebar

Collapse
Jai Vrat Singh
Jai Vrat Singh
Last Activity: Dec 15 '06, 09:12 AM
Joined: Oct 6 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Jai Vrat Singh
    replied to grep in C code
    in C
    try using functions generated by lex ..search google for lex
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to header file
    in C
    sometimes it cotains important macros as well
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to copy two struct
    in C
    That is true.
    if you do not want to use loops, use memcopy to copy memory in one go
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to need help!!!!
    in C
    Code:
    /home/jaivrat/cpp/test>cat -n test.cpp
         1  #include <iostream>
         2  #include <string>
         3  
         4  int main(){
         5  
         6    std::string str;
         7  
         8    std::cout<<"Please eter string:";
         9    std::cin>>str;
        10    for (int i=0; i< str.length(); ++i){
        11      std::string temp("");
    ...
    See more | Go to post

    Leave a comment:


  • Try including
    Code:
    #include<string>
    By mistake i missed it. Pls revert back if it works now..
    I was using g++ on cygwin it did not give me errors.....
    See more | Go to post

    Leave a comment:


  • looks like a school assigment which nobody wil want to do..but just FYH

    Code:
        1  #include<iostream>
         2  #include<fstream>
         3  #include<map>
         4  #include<ctype.h>
         5  
         6   typedef std::map<std::string, int> StrMap; 
         7  void recordData( StrMap& m, std::string& str);
         8  
         9  int main(int argc, char* argv[]){
    ...
    See more | Go to post

    Leave a comment:


  • Because you are delaring it as a reference... all references mut me intialised in the intialisation list of the Ctor rather than the body for Ctor.. Reason is obvious.. reference point to a definite memory as soon as they come into existence..

    I hope you understand diff between intializer list and assignment inside Ctor body.. if not, then reply back ..or you may find it in any std text.
    See more | Go to post

    Leave a comment:


  • Full code:
    Code:
         1  #include<iostream>
         2  #include<cstdio>
         3  #include <sys/types.h>
         4  #include <dirent.h>
         5  #include <cstdlib>
         6  #include <cerrno>
         7
         8  int printFiles(char * dirname);
         9  int countFiles(char * dirname);
        10  int main( int argc, char *argv[]){
        11
        12  printf("argv[1]
    ...
    See more | Go to post

    Leave a comment:


  • a small sample.. use it to count or to print :)
    Code:
    int printFiles(char * dirname){
    
         DIR* dirp;
         dirp = opendir(dirname);
         struct dirent * dp=0;
         int i=0;
         while (dirp) {
         i++;
         std::cout<<" In while loop "<<i<<std::endl;
             errno = 0;
             if ((dp = readdir(dirp)) != NULL) {
               std::string curr(dp->d_name);
    ...
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to program of structure
    in C
    I think this quest should not belong to a C/C++ tech forum. Anyways this is not an answer to your question
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to Struct in C
    in C
    What do you exaclty want to know. Can you post the hypthetical output you expect.

    You code will print the pointer(address es) of adjacent structures. thus if we say (suppose) the junk address contained by defn:

    Code:
    struct Calib *st_ptr;
    is 4022 and size of int(or unsigned int) on your machine is 4, then delta=(3+3*3*2) *4 = 84, your program will print
    4022
    4106
    4190
    ......
    ...
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to help
    in C
    Take hint from this post http://www.thescripts.com/forum/thread556816.html
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to self-referential structure
    in C
    struct Point {
    float x;
    float y;
    struct Point* next;
    };


    Generally nodes of linked lists are examples of self referential structures - which refer to memory location of same type by storing a self type poiter as a member.
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to virtual destructor
    in C
    Can you pls rephrase your question so that we can know what you want to ask ?
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to my Vector class
    in C
    It should not fail, You are doing a major mistake.. How can you take a char pointer argument from stdin ????? Do you know address where chars are stored..

    here it works
    [HTML][jsingh]:/home/jsingh/cpp/templates/test% ./a.out
    Enter 5 elements
    1 2 3 4 5
    1 2 3 4 5
    aa bb cc dd eee fff ggg
    aa bb cc dd eee a t g e f [jsingh@sgs45a-0145]:/home/jsingh/cpp/templates/test%...
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to Pointer troubles
    in C
    I am not sure if you are saying the it soes not gets substr method of std::string class , but effect you are trying to achive can be done by

    Code:
    int DoSome(string *inp) {
    if ((*inp).substr(0,6)=="myflow") {   // here's my problem, inp only points, and don't got the method substr.
    (*inp) = (*inp).substr(6);
    // lot of code here
    }
    return (0);
    }
    
    int DoSome(string &inp)
    ...
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to Integral functions in C++
    in C
    Standard C does not provide any intergral functions like Integral of x*x from limits 2 to x=4 and give you answer like ( 1/3) ( 4*4 - 2*2)

    You can find MATLAB and othe available libraries for this.

    Moreover you can write your own by using infinitesimal summation methods..

    Cygwin alo provides similar utilities.
    See more | Go to post

    Leave a comment:


  • Jai Vrat Singh
    replied to circular queue implementation in array
    in C
    I wrote this badly but funda remains same the--> % operator to go to correct place in array. I have not tested it properly.. but some work reqd by you :)

    [HTML] 1 #include<stdio. h>
    2 #include<assert .h>
    3
    4 #define SIZE 10
    5
    6
    7 struct Queue {
    8 char arr[SIZE] ;
    9 int front;
    10 int back ;...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...