b*********n 发帖数: 1258 | 1 想利用别人定义好的一个程序
int* LinearSuffixSort(char*& inputString, int& stringLength);
inputString is the pointer to the string to be sorted. stringLength is the l
ength of inputString.
===================
我的程序是这样的
#include "LinearSuffixSort.h"
using namespace std;
void main(int argc, char* argv[]){
char * fileName="abcdefg";
cout << LinearSuffixSort(fileName,7) << endl;
}
===================
Compile不通过
error C2665: 'LinearSuffixSort' : none of the 3 overloads can convert parame
ter 1 from type 'char *'
== |
w****a 发帖数: 186 | 2
l
int iLen = strlen(fileName);
cout << LinearSuffixSort(fileName, iLen) <
parame
【在 b*********n 的大作中提到】 : 想利用别人定义好的一个程序 : int* LinearSuffixSort(char*& inputString, int& stringLength); : inputString is the pointer to the string to be sorted. stringLength is the l : ength of inputString. : =================== : 我的程序是这样的 : #include "LinearSuffixSort.h" : using namespace std; : void main(int argc, char* argv[]){ : char * fileName="abcdefg";
|
b*********n 发帖数: 1258 | 3 这个我修改了
但是还是不行
我不知很明白char*& inputString是什么意思
the
【在 w****a 的大作中提到】 : : l : int iLen = strlen(fileName); : cout << LinearSuffixSort(fileName, iLen) <: parame
|
a****1 发帖数: 61 | 4 no problem when you use:
char * fileName="abcdefg";
int L = strlen(fileName);
LinearSuffixSort(fileName,L);
At least I have just tested it on vc++2005.net
【在 b*********n 的大作中提到】 : 这个我修改了 : 但是还是不行 : 我不知很明白char*& inputString是什么意思 : : the
|
b*********n 发帖数: 1258 | 5 1>Compiling...
1>msa.cpp
1>c:\program files\microsoft visual studio 8\vc\include\sys\time.h(126) : er
ror C4980: '__value' : use of this keyword requires /clr:oldSyntax command l
ine option
1>c:\program files\microsoft visual studio 8\vc\include\sys\time.h(126) : er
ror C3630: error when processing the token '__value'
1>c:\program files\microsoft visual studio 8\vc\include\sys\time.h(126) : fa
tal error C1190: managed targeted code requires a '/clr' option
1>Build log was saved at "file://c:\Doc
【在 a****1 的大作中提到】 : no problem when you use: : char * fileName="abcdefg"; : int L = strlen(fileName); : LinearSuffixSort(fileName,L); : At least I have just tested it on vc++2005.net
|
a***n 发帖数: 1 | 6 int* LinearSuffixSort(char*& inputString, int& stringLength);
Modify the statement:
cout << LinearSuffixSort(fileName,7) << endl;
to
int i=0;
cout << LinearSuffixSort(fileName,i) << endl;
This is because the function prototype is
int* (char*& , int&);
Whenever you want to reference to som obj, you have to allocate memory for
that obj first. |
D********g 发帖数: 650 | 7 const char*
l
【在 b*********n 的大作中提到】 : 想利用别人定义好的一个程序 : int* LinearSuffixSort(char*& inputString, int& stringLength); : inputString is the pointer to the string to be sorted. stringLength is the l : ength of inputString. : =================== : 我的程序是这样的 : #include "LinearSuffixSort.h" : using namespace std; : void main(int argc, char* argv[]){ : char * fileName="abcdefg";
|
G*O 发帖数: 706 | 8 inputString is a reference to a pointer pointing to a char.
【在 b*********n 的大作中提到】 : 这个我修改了 : 但是还是不行 : 我不知很明白char*& inputString是什么意思 : : the
|