~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Go to Project -> Build Options and check the first entry at the bottom panel (produce debugging symbols -g). This should do it for the current project.

If you want to always compile in debug mode you can make the -g default by going in Build -> Compiler Options -> Produce debugging symbols -g.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I will assume from your post that this is your first attempt as C++ programming i.e. you are a beginner. To start get a good book and if you are at an University, you can get the book from the library or read whichever book you are referring.

Some basic tutorials (must read) :
http://www.cplusplus.com/doc/tutorial/
http://www.cprogramming.com/tutorial/lesson1.html
http://www.cs.wustl.edu/~schmidt/C++/

After you finish reading the above tutorials and get a bit of understanding, you can start off with Thinking in C++.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Okay, since I don't know how you created your project, I will give a brief walkthrough on how it is done.

  1. Go to File Menu -> Close Project. This should close all the windows or projects you must have opened and help us in starting a new project.
  2. After closing the project, you are directed to a welcome screen on which you will see a host of options.
  3. Click on "Create a new project"
  4. Select "Console Application". Make sure the language selected is C++.
  5. When you click on create button, a new window will pop up asking you for the path on which you want to save your project t o. Select an appropriate path, preferably create a new folder, with the name of your project and save your project in that folder.
  6. When you do so, you will return to the normal view and see a blank screen.
  7. On the left side of the screen, there will be a sub window called view manager which will show the file hierarchy with the name of your project. Open up the hierarchy by double clicking on it and then open the file main.cpp in the same manner.
  8. Start coding.

If you face problems even after this, let me know.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

As for the warning message, all standard C++ compilers and so gcc requires you to have a newline at the end of the program according to the C++ standard:

2.1/1.2 "If a source file that is not empty does not end in a new-line
character, or ends in a new-line character immediately preceded by a backslash character, the behavior is undefined".

And as far as running the program is concerned, you have got three buttons at the top of your code blocks interface -- a gear (which compiles the code), an arrow( which runs the code) and a gear with a red arrow( which compiles and runs the code).

Best is that you use the function key F9 to compile as well as run the code.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Oh..I have used almost all the IDE's -- Visual Studio 6, Visual Studio .NET, Code::Blocks, Dev C++ etc.

Currently using Code::Blocks.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You can look here for a two good C++ free IDE's. They both are integrated with interactive and graphical debugger which should really go easy on you.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

He was just hoping... :mrgreen:

Yeah...not many girls around here to flirt with.....:twisted:

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

girl? wtf?
jesus

cout << "i Am MALE"<<endl ;

:eek:

Heh...it was a Christmas joke....:D
Merry Christmas :twisted:

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Good girl....;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You still haven't incorporated all the changes proposed to make your program from a working program to a better or portable program....

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Few points:

  • Don't use void main( ) , use int main( ) since main always has and always will return int according to the standards.
  • Don't use old style of header inclusion i.e. the .h notation. Instead use #include <iostream> followed by using namespace std ;
  • As far as your errors are concerned, they are due to the fact that you have forgot to close your if stmts . Each if stmt must have a complementary else stmt.

What you have is

if( some_condition )
{
    // stmts 

     else
     {
      // some_stmts
      }
}

// which should actually be like:
if( some_condition )
{
      // stmts
}
else
{
     // some stmts
    
     if( another_condition )
     { }
}

But there is a better way of doing things using the else if stmts.

if( some_condition )
{
    // stmts
}
else if( another_condition )
{
    // stmts
}
else
{
    // stmts
}

I hope you catch the drift...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There is no portable way of changing text color in C. It is highly a compiler dependent or OS dependent feature. If you are using Turbo compiler you can use the console I/O functions cprintf() and cputs() for color output.

#include <conio.h>
      int main()
      {
          textcolor(BLUE);
          cprintf("I'm blue.");
          return 0 ;
      }
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Because when you are reading data from the file, it is read in the form of string and in your case, its C string.

The thing about C strings is that other than the characters it holds, it reserves a extra space at the end of the character array for the null character ('\0') which signifies the end of the C style or character array style string.

So when you are reading "AAAA" in your case, its actually is :

AAAA'\0'

As you can see the last character is the null character which is automatically appended at the end of character arrays so that they can be treated as strings. This null character even doesn't show up when you query the length of the string using strlen( ) and hence is a common mistake made by beginners to assume that C strings only require the size equivalent to the number of characters they contain.

So in your previous code, you were using an array of size 4 which caused the null character to be copied to a location which doesn't belong to you and it overwrote the memory which you don't own. This normally leads to what is known as "Segmentation Error" i.e. modifying or touching memory which doesn't belong to you.

Hence changing the size from 4 to 5 caused your code to function correctly. Also consider changing from three sscanf( ) statements to a single fgets( ) and sscanf( ) which leads to a …

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I'm sure you eagle -eyed pro's can spot the problem in a New York minute, but I've been straring at this too long!

I don't blame you, since what you encountered is one of the C++ gotchas and not many starters know about it.

What you are trying to do here is to create a function which will befriend all the specializations of the Array class, which I don't think any compiler conforming with the standards will allow you to do.

There are some things which you have to do to get around this...

1. Forward declare the class, along with the templated overloaded function.

template <class T> 
class Array ;
template <class T>
ostream& operator<< ( ostream&, Array<T>& ) ;

2. Place <> after the overloaded operator to let the compiler know that this is a templated funcion you are tryign to code here (syntactic sugar...bleh). Something like:

template <class T> //declare the template and the parameter
class Array       // the class being paramterized
{
    public:
        ....
        friend ostream& operator<< <>(ostream&, Array<T>&);
    private :
        ....
};

For an interesting read look here.

SpS commented: Nice~~SunnyPalSingh +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hmm...I think there is some typo mistakes in the above one posted by Mr. Dave.

int compareChar(char *myArr, char *mySecArr)
{
   int count = 0;
   size_t len = strlen(mySecArr);

   // mySecArr should be myArr
   while ( (mySecArr = strstr(myArr, mySecArr)) != NULL )

   {
      count++;
      // mySecArr should be myArr
      mySecArr += len;
   }
   return count;
}
John A commented: Sharp eyes. :) --joeprogrammer +4
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

No need to complicate matters, here is a simple way of using the function..

#include <iostream>
#include <windows.h>
using namespace std;
 
int main(int argc, char** argv)
{
    cout << "Hello" << endl ;
    cout << "Wait for 3 seconds..." << endl ;
    Sleep(5000) ; // takes the time in milliseconds ( 1 second = 1000 milliseconds)
    cout << "World" ;
    getchar( ) ;
    return 0 ;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I ve been told for a sleep function but i can't find any info about it....Any thoughts on how i should implement this method?

If you are using Linux, then this for sleep and if you are using windows then this.

also is there any way to read the system time through c++?{to know what time appears in the system clock}

Yes there is, use the header file #include <ctime> if using C++ or #include <time.h> if using C. For the header reference see here and here.

thanks in advance for your help....Nicolas

Glad we could help.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

you did not code the class constructor or destructor.

Hmm..I don't think that makes a difference in this case since the object will be created irrespective of the initialization of the member variables and desctructors in such small programs are as such better left alone...

I am using this now:

void parseFile(ifstream& in)
{
    string tmp;
    Opra_record rec; // = new Opra_record;
    while(!in.eof()) {
        in >> rec;
    }
}

You forgot to incorporate the tips given to you.
And basically what you are doing is going in the wrong direction. You need not put the while loop in the parseint( ) function but in the overloaded friend function. Something like:

std::ifstream& operator>>(std::ifstream& in, Opra_record& r)
{
    string temp ;
    while( in >> temp )
    {
         // create accessor function for each private variable so that
         // you can retrieve them later from any part of the program
         r.get_string_data().push_back( temp )  ;
     }
}

void parseFile(ifstream& in)
{
    Opra_record rec = new Opra_record( );
    in >> *rec;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Dragon-

I will include my full code below, I had edited out a few things for brevity.

Why do you not construct the Opra_record here:

Opra_record* rec; // = new Opra_record;

Your friend function expects a reference to an instance of Opra record, it doesn't matter whether that Opra record has been statically or dynamically created.

Do something like:

Opra_record* rec = new Opra_record( ) ;
// and then use it as
while( in >> *rec )
{
   // your code here
}

OR

Opra_record* rec = new Opra_record( ) ;
Opra_record& ref_rec = *rec ;
while( in >> ref_rec )
{
   // your code here
}

Since I don't have a compiler right now, I havent tested the code, but it should pretty much work out to be well...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there buddy, welcome to Daniweb....:D

Maybe you should post your question in the correct forum...like the Microsoft Windows > Software forum.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Here is the reference site.

Here is a small example:

#include <iostream>
#include <ctime>
using namespace std ;

int main( )
{
    char buffer[BUFSIZ] = { '\0' } ;
    time_t now = time( &now ) ;
    struct tm* local_time = new tm( ) ;
    local_time = localtime( &now ) ;

    strftime( buffer, BUFSIZ, "%d / %m / %Y", local_time ) ;
    cout << buffer ;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Jobe, my very first reaction would be, why not write a generic function instead of restricting yourself with search strings of length 2 or 3.

goes out of bound. Isn't that bad coding?

Its not bad coding, its wrong coding. How can you expect your program to perform properly and in the right manner if you are basing your programming logic on computations on areas of memory which don't belong to you ?

Also the trick which you use will soon turn out to be cumbersome if you are asked to do the same with 3 letters, 4 letters, n letters etc.

My thoughts: always look for generic patterns in the problem statement and if they don't incur additional overheads for that case, go ahead and implement them.

For eg here is one implementation which is possible. I haven't tried it but it should pretty much work.

// retuns the last position in the string where the match was found
// modifies the count parameter passed by reference which displays the
// number of times substring occurs.
int my_strstr( const char* str1, const char* str2, int* count )
{
    int i = 0 ;
    int len1 = strlen( str1 ) ;
    int len2 = strlen( str2 ) ;
    int pos = 0 ;

    *count = 0 ;    // initialize the counter

    for( i = 0; i < len1; ++i )
    {
        if( strncmp( ( str1 + i ), str2, len2 ) == 0 )
        {
            (*count)++ …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Okay here is a simple solution which I have got verified so it should work out to be fine for any length strings...

#include <stdio.h>

void remove_s( char str[] )
{
    while( *str != '\0' ) {
        if( *str == 's' || *str == 'S' ) {
            remove_s( ++str ) ;
            // after returning from the function don't continue with loop
            // this is to avoid the destruction of counter position
            break ;
        }
        else {
            ++str ;
            if( *str == '\0' )
                return ;
        }
    }

    --str ; // take into account the increment which had occured

    // now its a simple thing of shifting chunks
    while( *str != '\0' ) {
        *str = *( str + 1 ) ;
        ++str ;
    }
}

int main( )
{
    char str[] = "She will be a massless princessi" ;
    printf( "\nThe old string: %s", str ) ;
    remove_s( str ) ;
    printf( "\n\nThe new string: %s", str ) ;

    getchar( ) ;
    return (0);
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Therefore, I would recommend you use something like this:

if(strcmp(arr, arr[j]) < 0)

rather than this:

if(strcmp(arr, arr[j]) == -1)

Yes I would ask you to compulsorily make the change.

Normally the strcmp( ) returns -1 , 0 or 1.

Try out this program:

#include <stdio.h>
#include <string.h>

int main( )
{
    // all return -1 on my compiler
    printf( "The ans is %d", strcmp( "ABCD", "abcd" ) ) ;
    printf( "The ans is %d", strcmp( "abcc", "abcd" ) ) ;
    printf( "The ans is %d", strcmp( "abcb", "abcd" ) ) ;

    getchar( ) ;
    return 0;
}

But the documentation states that it returns a value lesser than 0 when the first string is less than the second string so you are better off using the < operator rather than comparing for -1.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hmm...actually too many logical problems:

1. strcpy_s is a non standard function which works only in the case of MS compilers and would not compile on any other standard compilers. Stay away from it and just do as the warning says i.e. use _CRT_SECURE_NO_DEPRECATE.

I guess its just MS's way of saying that they know the standards better than the standard setters so you better use their new functions. IMHO stay away from it and use normal functions.

2.

short input(char arr[][10], const short SIZE)
{
    char tempStr[10][10];
    short amount = 0;

    for(short i = 0; i < SIZE; i++)
    {
        std::cin >> tempStr[i];
       <snip>
    }
}

Come on Jobe, why you need to declare a temporary two dimensional character array for holding the temporary string when you can do the same using a single character array.
Something like:

short input(char arr[][10], const short SIZE)
{
    // if possible always initialize variables to avoid subtle bugs
    char tempStr[BUFSIZ] = { '\0' } ;
    short amount = 0;

    for(short i = 0; i < SIZE; i++)
    {
        std::cin >> tempStr ;
       <snip>
    }
}

3. The given piece of code is well..bad. Declaring variables or placing snippets which always perform a constant function inside a loop is bad programming practice. It wastes your precious memory and processor cycles..
You wrote:

if(strcmp(arr[i], arr[j]) == -1)
{
     // what is a variable declaration doing inside a loop !!!
    // move it outside and place it …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Post your errors and highlight the lines on which they occur...that way it would be easier for us to spot them...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though it would have been simple if they had something like:

// more simple to understand and no need of keeping in mind the 
// ASCII equivalent of '0'
temp[k++] = remain + '0' ;
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Somehow, I'm just not seeing what it is that is wrong with the code Ive written with the help of the pseudo code from Lerner.

Okay. Here this goes.

What Mr. Lerner tried to explain is that if you start from the start of the array, you would have a hard time keeping track of duplicates.

Eg. one, two, one, two, three

If you begin at the start of the array you have no way of knowing that the current word under consideration would be repeated or not i.e. if we consider the first word "one" we have no way of knowing that "one" would occur again or not.

The only logical thing to beat this problem would be to start from the end of the array, eg. "three", look up for it in the whole array, and see if it occurs anywhere in the whole array. If it does, don't print "three" because we know for sure that we will encounter "three" again definately.

A sample run for input "one, two, one, two, three"

Current Word: three
Searching upwards for "three"...not found
Print "three"

Current word: two
Searching upwards for "two"...found
Dont print "two"

Current word: one
Searching upwards for "one"...found
Dont print "one"

Current word: two
Searching upwards for "two"...not found
Print "two"

Current word: one
Searching upwards for "one"...not found
Print "one"

I won't let you give up so easily ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe even I should attempt and post the solution to Professor WaltP.

Yay atlast we get a qualified teacher who balks at void main ( ) :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

*sigh* We really will miss you JoBe, though I wish you hadn't given up.

Your friend always,
~s.o.s~

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Just wanted to tell you that sometimes your description is rather vague. Always post a question in such way that the person reading it doesn't have to use a compiler to test it out what is going wrong.

If your program displays something and takes some kind of user input, just paste a sample output which is erroneous or not as expected along with what did you expect. This kind of description will help us understanding the problem better.

Now as per your question is concerned, your program only checks to see whether the preceding string is equal to the current string and if it is so then it just skips printing the current string. But your program will fail in conditions where you alternate the words inputted to the program like:

hello
hell
hello
hell
hello

I hope you understand the twist .

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The examples in that previous thread use additional variables/functions to do the job. The OP wants to remove the character without using additional variables or functions.

Does my this solution use more than one variable ?

void remove_s( char tmp[] )
{
    while( *tmp != '\0' )
    {
        if( *tmp == 's' || *tmp == 'S' )
        {
            memmove( tmp, tmp + 1, &tmp[strlen( tmp )] - tmp ) ;
        }
        else
        {
            tmp++ ;
        }
    }
}

I guess I will leave it to someone else to solve his problem since I really dont understand what he is asking for.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Doesnt this post solve your problem ?
.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You need to escape the \ character since the it is seen by the compiler as the language construct.

You can do something like: sprintf( acFilename, "c:\\a%d.txt", count ) ; Use \ to escape the special \ character. In C and C++ \ is the escape character used to escape some special characters like ", ' and so on..

Also I think it is not a good practice to use \\ since its not portable. If possible try using sprintf( acFilename, "c:/a%d.txt", count ) ; which is a much better way to do things the right way.;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

*sigh* people nowadays demand so much...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void remove_s( char tmp[] )
{
    while( *tmp != '\0' )
    {
        if( *tmp == 's' || *tmp == 'S' )
        {
            memmove( tmp, tmp + 1, &tmp[strlen( tmp )] - tmp ) ;
        }
        else
        {
            tmp++ ;
        }
    }
}

int main( )
{
    char* tmp = 0 ;
    char str[] = "Ass is an ass and nothing but ass, so be solemn" ;
    printf( "\nActual string: %s", str ) ;
    remove_s( str ) ;
    printf( "\nNew string: %s", str ) ;
    getchar( ) ;

    return 0 ;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

the "this" keyword is a pointer to the class in which it's used. For example:

this->idNum

Is referring to the idNum data of the class your writing for.

So to answer your question, yes you would only need the "this" keyword if your working with pointers because it is essentially a pointer. It's the pointer of a class pointing to itself, if that makes any sense to you.

Looks like you are using the words class and object interchangeably.

Correction:

The this pointer is a pointer accessible only within the nonstatic member functions of a class, struct, or union type. It points to the object for which the member function is called. Static member functions do not have a this pointer.

An object's this pointer is not part of the object itself; it is not reflected in the result of a sizeof statement on the object. Instead, when a nonstatic member function is called for an object, the address of the object is passed by the compiler as a hidden argument to the function.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How about something like:

void remove_s( char str[], char* tmp )
{
    tmp = str ;
    while( *tmp != '\0' )
    {
        if( *tmp == 's' || *tmp == 'S' )
        {
            memmove( tmp, tmp + 1, &str[strlen( str )] - tmp ) ;
        }
        else
        {
            tmp++ ;
        }
    }
}

int main( )
{
    char* tmp = 0 ;
    char str[] = "Asses are asses and nothing but asses" ;
    printf( "\nActual string: %s", str ) ;
    remove_s( str, tmp ) ;
    printf( "\nNew string: %s", str ) ;
    getchar( ) ;

    return 0 ;
}

And btw...it was not at all interesting..;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I know it was wrong and was going to edit the post but dont know why it works in my case....

Just wanted to make someone double cheked it because it works in my case( dont know how ).

Mr. Dragon, if you have a VS2005, can you please check it out because Jobe has I think got a VC6.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Okay looks like something queer is going on around here. I ran the same program without any modifications and this is what I get:

January
February
March
April
May
June
July
August
September
October
November
December

Press ENTER to continue.
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

@ AD,
Thanks AD, but, I thought that begin and end also worked with strings no?

Iterators work only for C++ containers. String, Vector etc. are containers and iterators work well with them. Array is not a C++ container class. You can use iterator to walk through the characters of the string..

@ s.o.s,
That doesn't work s.o.s, I think it's because strings are not \0 terminated.

If you will look closely, I have done "str != 0", here str is a pointer. The above code works perfectly well for me.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How about something like:

for( const std::string* str = myArray ; str != 0 ; str++ )
        std::cout << *str << '\n';
    std::cout << '\n';
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It does not mean the user can input as many strings it means that at the time of declaration of your array of strings you can initialize it with as many strings there as possible and the compiler will figure that out for you.

It also tends to save space as compared to the normal method of creating a two dimensional character array.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

My pleasure....also one more thing to point out.

The entry point of the program i.e. main( ) returns int so the correct way to write programs would be

int main( ) 
{
   // write your code here
  return 0 ;   // dont forget to return program status
}

Also dont use getch( ) its non standard, use getchar( ) to achieve the same purpose ie stopping the screen.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You have declared prn_random_fcookie( ) as prn_random_fcookie( char ) ; while you have defined it as

prn_random_fcookie( )
{
   // you code here 
}

As you can see the declaration and definaton dont match.

Also what you need to do is to pass the function nothing, calculate a random integer between 0 to 4 (since your string array has 5 strings ) in your function itself and use that integer to print out a random string.

Also it would be better if you declare the array of strings as

char* fc_array[] = { "Everything will now come your way.",
                                  "Now is the time to try something new.",
                                  "A handful of patience is worth more than a bushel of brains.",
                                  "You have an active mind and a keen imagination.",
                                  "Don't let doubt and suspicion bar your progress."
                                } ;

since this method helps save space and letst the compiler take care of things for you.

You need to write in your function somethign like:

int random = rand( ) % 5 ; // generate random between 0 and 4
printf( "%s", fc_array[random] ) ; // use that random to index your string array

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I always wonder how you guys come up with such good links you know

Err...I hope you know that he is not exactly a 12 year kid . :mrgreen:

Going into professional software development, hauting the google groups and various forums is what makes a good programmer. (and of course dedication and interest)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Congratulations, sit back, relax and enjoy your weekend. ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Sheesh you got confused between the two pointers girly...:D

Here is the modified version, I just swapped p and str and made a change to the condition being checked..

void removeSfromString(char *str)
{
    char *p;
    p = str;

    while (*p != '\0') // '\0' is the string-terminator character
    {
        *str = *p;
        p++;

        if (*str != 's' && *str != 'S')
        {
            str++;
        }
   }
    *str = *p;
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Copy the current character from source to the current character of ptr.

This doesnt mean to use strcpy( )..you are not dealing with strings here, jsut normal characters. Assign the character at the position source to the character pointed by ptr. *ptr = *src ;

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You have used two variables in your function and that too not of pointer type which goes against your program requirement.

As far as this program is concerned go with Mr. WaltP's algorithm and it should work out to be fine.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

All the normal compilers will work with the SQL commands if you set up the path for header and library files and include the required header file in your prorgram. So you can continue using the compiler which you are using right now (cant say the same if you are using Turbo C).

You can search on google for [search]mysql and c++[/search].