Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by kriscs1

  1. kriscs1

    Instr() function

    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 :)
  2. kriscs1

    File input

    ahh thank you.. i did not know you could use a delimeter with getline().
  3. kriscs1

    Instr() function

    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......
  4. kriscs1

    File input

    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...
  5. kriscs1

    Instr() function

    anyone? :)
  6. kriscs1

    Instr() function

    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) {...
  7. kriscs1

    Occurences of char* in another char*

    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...
  8. kriscs1

    Instr() function

    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...
  9. kriscs1

    Instr() function

    :( It now says:
  10. kriscs1

    Instr() function

    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[...
  11. kriscs1

    Instr() function

    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
  12. kriscs1

    Instr() function

    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()...

Part and Inventory Search

Back
Top