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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: tokra
  • Order by date
  1. tokra

    Encrypt/Decrypt files by XOR

    I actually can't figure out why it's decrypting that much. It should never decrypt more than 32 bites of data because that is the maximum password size and all your loops only go that far. an alternate solution that didn't include so many temp variable might also look like this void...
  2. tokra

    finite state machines

    The code above isn't compiled i forgot the cases (Shows how much i use a switch) WR
  3. tokra

    finite state machines

    I have an application where I have to read in large quanties of data from a file. The records are mixed binary and ascii having no standard format save a 4 charachter delimiter at both the beggining and end of a record. The delimiter is assummed but not garunteed to only occur there and not in...
  4. tokra

    Efficient Numerical Search

    If you know beforehand the size of the list and that all numbers are expected to be consecutive... here are some uncompiled ideas this one finds the sum of all the numbers in the series and then subtracts all the values from it. whats left is what we are missing unsigned int...
  5. tokra

    caching files

    I am processing files of our SAN, to minimize network load and load on the SAN (it is an issue in my enviornment) I want to cache the entire file to memory when it's opened. Writing my own file class is what I'm doing right now, but I am finding out how much of a pain it is. The file is part...
  6. tokra

    Cout<<flush?

    it makes sure what you've written is on the screen and not just buffered. The same idea applies to an ofstream as well. http://www.cplusplus.com/ref/iostream/ostream/_flush.html WR
  7. tokra

    can't compile source code

    I only have vis 7.0 and it compiled fine, however 1: use iostream and namespace std #include <iostream> int main() { using std::cout; using std::endl; cout << &quot;Hello World&quot;<<endl; return 0; } 2: specify that main have a return type of int...
  8. tokra

    parsing strings

    1:Where do you allocate the memory for tmp? do you use new or point it at a char[] declared on the stack 2:That code just changes the first char, it doesn't append. 3:a \0 never gets put in so any string handling functions are going to run off the end. WR
  9. tokra

    A function in a DLL that returns a string

    I think VB can take char *'s WR
  10. tokra

    ofstream

    I am trying to write a program to verify that a hard drive can store data without corrupting it. I have written a class called randomData that is filled with a std::vector of 1k std::strings. The program prompts you for how big you want to make the class and then how times you want to repeat...
  11. tokra

    compromise output vs speed

    teriviret- thanx for the tip, I didn't know you could do that. obislavu- I like the first solution too cause there's less room for screwing it up when you code it. It all comes down to how fast the % operator is With the first one recordsparsed%threshold must be computed for every iteration...
  12. tokra

    compromise output vs speed

    recently I've had to write a couple of apps that parsed text files that were a couple of gigs apiece. I wanted to output to the user that some progress is beeing made, but I don't wan't do it every line. I've come up with two solutions and was wonering which one is closer to whatever the...
  13. tokra

    Sorting Strings

    If you implement the == operator and the < operator, you can store your struct in a standard container like a list or vector and use the containers built in sort algorithim. WR
  14. tokra

    classes and pointers, is this right???

    pointers are pointers to locations in memory. Any function that has a valid pointer can modify the data that pointer contains regardless of who actually owns the data. Your getFirstname functions returns the pointer to your internal data. Run the following demonstration code to get a better...
  15. tokra

    How to check if file exists ?

    What version of the librarys are you using? The following code leaves my c:\ untouched #include <iostream> #include <fstream> void main() { std::fstream in; in.open(&quot;c:\\dontcreateme.txt&quot;); } if you are using the versions found in the .h files you can 1:not (preferred...
  16. tokra

    CSocket

    Why don't you use the debuger to look at the internals of the exeption class. If you can't get anything readable from that at least you know what kind of class is beeing thrown. You can 1:see if it has any member functions or variables that might help diagnose the problem and if so you can trap...
  17. tokra

    classes and pointers, is this right???

    I noticed that your code used <iostream.h> most of the standard .h files are deprecated and you can't mix and match old .h's with the the new ones. Note this only applies to the standard libs. use <iostream> ex #include <iostream> using namespace std; int main() { cout << &quot;Hello...
  18. tokra

    classes and pointers, is this right???

    By returning a char * from getFirstname you allow your callers to mess with the underlying data which kinda defeats the purpose of encapsulation. You can return a const char * so users can't screw with the data ---or--- you can return a copy of the data there are two ways of doing that 1: Use a...
  19. tokra

    Loki Typelists help

    Why does searching the map take O(n)? Assuming that your implementation obeys the complexity rules of the STL and isn't just a set of classes it should only take O(log(N)) time shouldn't it? http://www.sgi.com/tech/stl/SortedAssociativeContainer.html WR
  20. tokra

    writing data do stdin

    I tracked down a solution here is the code the demonstrates it. #include <iostream> #include <stdio.h> #include <process.h> int _tmain(int argc, _TCHAR* argv[]) { std::cout<<&quot;Items written to stdin:&quot;<<fwrite(&quot;test\n&quot;,1,5,stdin)<<std::endl; FILE* out...

Part and Inventory Search

Back
Top