nevermind, me dumb :)
admin, please remove this post!
Type: Posts; User: rox
nevermind, me dumb :)
admin, please remove this post!
god damn it... it compiles, works and passed all the test on AIX but it gives a segmentation fault on my personal linux box...
is there something wrong in my program or it's just the compiler not...
ok, so I make my init like so:
void Account::init(const char c[], const char num[], int b){
cout<<"in init next is check for customer"<<endl;
if(customer) {
delete [] customer;
}...
so I'm doing
customer = new char[strlen(acct.customer) + 1];
but than when I copy with
strcpy(customer, acct.customer);
the end of string does not get copied, right? do I have to add it in...
This is in main:
char d[] = " 113423454567987,83456,Baker,Susan,St. Louis-de-ha-ha,416-555-5599;";
char num[] = "aw0000000000000";
Account two(d, num, 5347);
Account three;...
If five and two are objects of type Account, this should not be a call to a copy constructor?
Account five(two);
copy constructor being declared:
Account::Account(const Account & acct){
great, that gdb is amazing, i had no ideea there's a debugger for prompt.
I was under the impression that only heavy-graphical-interface applications have a debugger.
(you learn something every...
ok, i've pinpointed it to this:
class A {
char * cr; //No memory allocation yet.
public:
//...............
~A();
i have a set of objects of class A as a data member of an object of class B using dynamic memory allocation. In A i got strings with dma.
delete [] A;
gives me a segmentation fault...
it...
i got a class bank, with one data member of type account (other class)...
i need to create a function grow that increases the number of acounts by a certain number...
in order to dynamically...
ok, there are no blanks on the first string, up to the first comma, than there is the integer value, and than there is another string containing characters, commas, blank spaces and who knows what,...
how do you read from a text file containing data in the following format:
someChars,integer,SomeCharsWithOtherCommas;someChars,integer,.... and so on.
I've tryed
fscanf(file, "%s,%d,%s;",...
yes i did, i got it to work.
THank you!
Great, now it makes sense. And it works too, but that comes as a bonus only :)
Thank you very much!
because the function prototypes given have that last "const" in there. So i'm just trying to figure out what it does. I found some examples in a book but i'm still clear as mud on this.
ok, got it... this works... but what is the last const doing in a function prototype like this:
const char* getSomething(int index) const
without that const it work like a charm, with it......
how do i get into a tempstring a string value from a data member of an object in an array of objects?
i thought it was:
strcpy(tempstring, array[index].getFunction() );
where the function...
i think i understand the idea, and i think it's case 3...
one of the data members in class bbb is an array of objects type aaa.
i'm trying to return from a member function in bbb the return of...
sorry, i think i pasted the wrong segment of code...
in aaa i got:
const char* getSomething();
and in bbb:
aaa somearray[10];
wrong code posted. see down!
the error i get is:
bbb.cpp: In member function `int bbb::getSomething(int) const':
bbb.cpp:261: passing `const aaa' as `this' argument of `int
...
ok, i got this:
a cpp file declaring a class, with it's header file containing function prototypes.
another cpp file containing a new class of objects of the previous class with another header...
great, thank Prelude. Now it makes sense.
Couldn't they put that info in the book too? grr.
Thank, so my suspicion was right.
Problem was, i got some function definition given, and until now i was using them the way they were given. Now they only gave me :
FILE* fuctionName(char [])...
beginner confused here:
FILE* functionName(char [])
where i pass a string as the file name, open the file and return fp.
how do i work with the passed string? Should i have a name[]...
:( it appears i am.
I've had strings mentioned only last week, and only how to read them from the input.
i don't have a problem reading more about it, but i'm not even sure what to lok for...