hmmm how stupid of me.... It's just that I saw a tutorial on strncpy_s() which showed sizeof() there and I just automatically added it to mine. thansk very much!
Works fine now :)
yes, it is strncpy_s() that is giving my the error.
sizeof( newSentence ) seems to always be 4 no matter what which is obviosly why it is too small if I input 0 and 4 to the function......
Hi, I have a file of words, all seperated by commas, in longs lines right to the end of the file. Some of the words go over on to the next line. How would I get all of these words individually into a variable? Any help would be great or a pointer to a website.
I hope this is not too much to ask...
I mean:
Mid("hello", 0 ,3) would output "hel"
The start point is 0 and it displays the next 3 characters.
Mid("hello", 0 ,4) howevers says the buffer size is too small.
char* Mid( char *Sentence, int FromNumber, int ToNumber = 0 )
{
int strLen = Len( Sentence );
if (ToNumber == 0)
{...
This works with all size search terms I think, from my thread:
int Instr( char *SearchString, char *SearchTerm,)
{
int stringSize = lb::Len( SearchString );
int termSize = lb::Len( SearchTerm );
if ( termSize > stringSize )
{
return 0;
}
int numberFound = 0...
I'm using VC++. strncpy_s() requires 4 parameters ,not 3 like strncpy().
I changed it to this:
strncpy_s(newSentence, sizeof(newSentence), &Sentence[FromNumber], offset);
However, if I use 0 and 3 as the firsts and second parameter, the function works. If I use 0 and 4 or anything higher...
Hi, thanks very much for that.
I couldn't get strlen() to work because it said it could not 'convert from size_t to int' but I just changed it to my own Len() function.
However, there is just one last error I cannot get to work.
referring to the line:
strncpy( newSentence, Sentence[...
Hi,
umm.. I'm using malloc() because I was told to by someone and i can't get it to work without it. How can I do it without it? Isn't that C++ code?
If I try and use the strcmp() function it says this:
Is there any website that explains STL string really simply?
Thanks very much
Kris
Hi,
I'm trying to make a function to count the occurences of a char or string in another string. (I know thee is a thread about this below but that is just for chars)
Please could someone tell me why my Instr() function does not work because I have no idea...
I presume it is to do with my mid()...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.