Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
1
Posts with Upvotes
1
Upvoting Members
1
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
0 Endorsements
~40.5K People Reached
Favorite Forums
Favorite Tags
Member Avatar for guest7

Hi, I wish to compare partial bits of two one dimensional vectors. I know how to compare the two vectors completely. [ICODE]int main () { std::vector<int> vector1; std::vector<int> vector2; int out; vector1.push_back(100); vector2.push_back(101); vector1 == vector2 ? out = 0 : out = 1; printf("out = %d \n", out); return …

Member Avatar for Dasun_1
0
27K
Member Avatar for guest7

Hi, I am trying to use the "partition" from STL algorithms. I get the following error: [CODE]error: no matching function for call to ‘partition(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >, <unresolved overloaded function type>)’ /usr/include/c++/4.2.1/bits/stl_algo.h:2098: note: candidates are: _ForwardIterator std::partition(_ForwardIterator, _ForwardIterator, _Predicate) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, std::vector<int, …

Member Avatar for Banfa
0
395
Member Avatar for guest7

Hi, I am trying to compile an open source code on linux Ubuntu and getting the following error: conflicting types for ‘strlen’ I am pasting the program in which it is giving me the error : [CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> #include "port.h" /* * strstr - find first …

Member Avatar for nezachem
0
458
Member Avatar for guest7

Hi, I am using the following code to convert character array in file to integer. However, the problem is that there is only one place in the file where it does not convert the character array to integer correctly. Since my code is big, i am pasting the most relevant …

Member Avatar for Ancient Dragon
0
140
Member Avatar for guest7

Hi, I am trying to see to which key the iterator is pointing in a map. is there a way to do so. Also, would it be the fastest way to store unique keys in a map. [CODE] mapType::iterator it = cube.begin(); mapType::iterator its = it; std::advance(its,1); for(; it!= cube.end(); …

0
55
Member Avatar for serkan sendur

is there any vay to access iterator's index value without using another variable in the for loop?

Member Avatar for guest7
0
175
Member Avatar for guest7

Hi, I am trying to read he has map starting from the second key instead of first key. I have two loops. One for loop iterator reads from the beginning of the has map. And the second for loop is trying to read from the second key of hash map. …

0
68
Member Avatar for guest7

Hi, I have a 2 dimensional vector containing entries such as : 10X 01X 001 I merge two rows at a time and get a new row of elements. In other words, when i combine "10X" and "01X" i might get "001" but since "001" is already there i do …

Member Avatar for programmersbook
0
83
Member Avatar for guest7

Hi, I am trying to replace the old_string with the new_string using sed. But i am unable to do it using the following script. [CODE]#!/bin/sh old_string="p cnf 10 20" new_string="p cnf 98 99" sed -e 's/old_string/new_string/' file1.txt > file2.txt [/CODE] Contents of file1.txt [CODE]p cnf 10 20 1 2 3 …

Member Avatar for chrislee.980
0
90
Member Avatar for guest7

Hello, I am having trouble in using the data member of class 1 in the member function of another class 2. Following is my code. [CODE]class a { public: a(); ~a(); std::vector<int> temp; }; class b { public: b(); ~b(); int test(); } b::b() { a *a1; a1 = new …

Member Avatar for sfuo
0
151
Member Avatar for guest7

Hi, I have two directories and each directory has a *.cpp and *.h and a Makefile. I am also creating an instance of the class of program1(in one directory) in program2(in other directory). I have a main Makefile that makes the two makefiles in each directory. i am getting the …

0
71
Member Avatar for guest7

Hello, I am getting the follwoing error in my program: *** glibc detected *** free(): invalid pointer The program is as follows. [ICODE]int main() { operation1* sjob1 = new operation1(); answer* ans1 = sjob1->execute(); delete sjob1; operation2* sjob2 = new operation2(); answer* ans2 = sjob2->execute(); return 0; }[/ICODE] I have …

Member Avatar for Topi Ojala
0
195
Member Avatar for guest7

Hi, I have a c++ program which uses the api's of a utlitiy. As per the document I have to include the path of binaries for the utility in my code. I am not sure why that is required and how to inlcude that. Any help is appreciated Thanks

Member Avatar for guest7
0
103
Member Avatar for guest7

Hi, I wish to know that the cause of the following error when i run the program : a) Is memory leak in the program B) The system on which i am running the program has insufficient memory. [ICODE] terminate called after throwing an instance of 'St9bad_alloc' what(): St9bad_alloc[/ICODE] Thanks

Member Avatar for drjay1627
0
112
Member Avatar for guest7

Hi, I am getting the following error in my code. [ICODE] malloc: *** error for object 0x3b0fe80: double free *** set a breakpoint in malloc_error_break to debug[/ICODE] When i debug it and do a backtrace i get the following [ICODE] #0 0x90c994a9 in malloc_error_break () #1 0x90c94497 in szone_error () …

Member Avatar for guest7
0
154
Member Avatar for guest7

Hi, I have to use fscanf to read the numbers in a line. The line is in the file "FileName1" and may or may not have EOF. I am using the following code and it is stuck in an infinite loop. [ICODE] FILE *Fileget; vector<int> get_value; Fileget = fopen(FileName1, "r"); …

Member Avatar for guest7
0
125
Member Avatar for guest7

Hi, Following is the function which is giving me a segmentation fault. I do not know what is wrong in this code. I am counting the number of lines in the file. [ICODE] char f11; char c; int f12 = 0; FILE *ilfile; ifstream ficnf; int size_f = 0; int …

Member Avatar for Nick Evan
0
146
Member Avatar for guest7

Hi, i wish to know the difference between the following two code? ifstream fin(fname,ios::in); vector<string> temp; while(getline(fin, line) { temp.push_back(line); } and while(!fin.eof()) { getline(fin,line); temp.push_back(line); } thanks

Member Avatar for ArkM
0
110
Member Avatar for guest7

Hi, I am getting "Segmentation fault" error in line number in the following function. [ICODE]deque <string> text; deque <string> text_1; int circuit::writetofile(int maxno,char *fname) { /* Before writing the clauses correct the line p cnf */ //deque<string> text; std::string s,t; /* Counting the number of original clauses in the file …

Member Avatar for nucleon
0
236
Member Avatar for guest7

Hi, I am getting the error "Segmentation fault" when i run my program. Then when i debug the code to find the cause of the error i get the following error messages. I do not know what these error messages mean: Error Message: ------------------------------------------------------------------ Program received signal SIGSEGV, Segmentation fault. …

Member Avatar for rm_daniweb
0
94
Member Avatar for guest7
Member Avatar for guest7

Hi, I wish to remove the extra unwanted characters in the file name. [ICODE]f1::f1(char *filename1) { char file_txt[40]; strcpy(file_txt,filename1); strcat(file_txt,".txt"); system("rm file_txt"); }[/ICODE] In debug mode when i check the value of file_txt i get : file_txt = "../../input.txt\000\000\000\000F\000\000\000\001\000\000\000\001\000\000\000\v\000\000\000\002\000\000\000\000\000\000\000\001\000\000" I do not know hoe to get rid of the extra …

Member Avatar for ArkM
0
94
Member Avatar for guest7

Hi, I am getting the following error while compiling the code on linux machine. "aggregate value used where an integer was expected" I am getting this error on a simple for loop. I do not know the reason for this error. Any help is appreciated. Thanks

Member Avatar for mvmalderen
0
62
Member Avatar for guest7

Hi, I am getting the following error when I am trying to initialize a 2 dimensional vector with 0's. I am not to figure out the reason. Any help is appreciated. [ICODE] std::vector<int> truth_table; std::vector<vector<int> > truth_table_col; double no_of_twos = 7; double base_two = 2; cout << "No of 2's …

Member Avatar for guest7
0
98
Member Avatar for guest7

Hi, I am comparing two file to find if they have common strings. My program is not doing that and I cannot figure out the reason. Any help is appreciated. Following is my code: [CODE]int main() { FILE *inf1 = fopen("file1.txt","r"); FILE *inf2 = fopen("file2.txt","r"); int numcols = 11; char …

Member Avatar for MrSpigot
0
90
Member Avatar for guest7

Hi, I am trying to compare two strings. When i enter two arguments on the command line 12 and 100, the flag1 should be set to 1 because (argv[1] =) "100" > (junk2 = )"13". But this is not happening. So, how can i check that the input arguments entered …

Member Avatar for Ancient Dragon
0
85
Member Avatar for guest7

Hi, I am getting a segmentation fault at the following line in the code. I am reading a file using ifstream. The file contains some initial junk data followed by useful data. I wish to read and discard the junk data from the file, before I read the useful data. …

Member Avatar for Ancient Dragon
0
110
Member Avatar for guest7

Hi, I am trying to read number from file. Following is my code. I am not able to read it correctly. When i>1 then i should read the second and third line of the file and store the values in the vector rows. But it is not reading the second …

Member Avatar for daviddoria
1
124
Member Avatar for guest7

Hi, I wish to read the file twice. I am using ifstream to read the file. I tried using rewind(File pointer). But i get an error. How can i do it. Thanks

Member Avatar for guest7
0
2K
Member Avatar for guest7

Hi, I am getting an error when running a code on linux machine: "terminate called after throwing an instance of 'std::bad_alloc' what(): St9bad_alloc Aborted" In my code i have a 2 dimensional vector defined. Can someone tell me the possible cause of error. Thanks

Member Avatar for guest7
0
78