REALLY URGENT!!!

My Program:

Done
Last edited on
Post the error messages.
Last edited on
You're treating char pointers like they're strings. Don't. The two are very different.

1
2
3
4
5
6
7
char* IndexDetails::Parser(char* del)
{
   char* m; int sub; int k= 0; string hold;
   sub = del.length();   // 'del' is a char pointer, it has no "length" function
   while(k < sub)
   {
     m = del[k];  // assigning a char to a char*  ??? 


There are a lot of problems with this code that I can see... and they all spawn from a misunderstanding of char*.

Keep it simple: don't use char* to represent strings. Use std::string.
See the problem I have is, when I return values of string type m not sure the program works. Actually whatever I do, the program doesn't work. So now I jus change my char* variables to std::string variables?Will that work?I dunno, I jus can't get the program to read from the file. I guess char* doesn't solve the issue, pls suggest some more changes possible.Tks, I really need to get this program working.

Plus my errors all involve the assignments, can't convert char to char* etc. An error, I often get deal with the != sign, it always indicates an error whenever I use it.
Last edited on
This is the program using strings but for some reason it doesn't accept my string compare commands.

Fixed
Last edited on
1
2
3
4
5
6
7
8
{
    char *s="Hello";
    std::cout <<(strcmp(s,"Hello")==0);
}
{
    std::string s="Hello";
    std::cout <<(s=="Hello");
}
Topic archived. No new replies allowed.