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...
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...
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...
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...
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
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 << "Hello World"<<endl;
return 0;
}
2: specify that main have a return type of int...
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
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...
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...
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...
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
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...
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("c:\\dontcreateme.txt");
}
if you are using the versions found in the .h files you can
1:not (preferred...
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...
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 << "Hello...
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...
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
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<<"Items written to stdin:"<<fwrite("test\n",1,5,stdin)<<std::endl;
FILE* out...
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.