I did what you told me but the results are still the same
That's because you did not do what I told you. You are still copying your path strings based on strlen rather than strlen+1. And you seem to be creating too many variables, most of which are just duplicates of existing items. This may well be what is causing you confusion.
That is because you keep doing the same thing wrong. You need to stop and think, and reread all my posts that explain how to do it properly. Especially look closely at the sample code I posted yesterday
i did do waht you told me i expended the string by 1
but that 1 byte is messing up my code
even trying using strcat just makes it worse I stopped and read all of ur recent psots but i have nothign that comes in mind that could help me
im sorry for giving you a hard time here but it is hard for me as it is
would you please fix the code to show me what you mean?
I did calculate the bytes and the characters as i needed it needs to be 24 bytes
when at the last code i posted you can see that until i reach to the point that is /1 its 23 bytes
the + 1 is the one i added so it will be the end of the string
Looks to me like you're most of the way there. You probably want to read in your reference file into a buffer. You can use _stat() to get the file size for malloc().
Next, it depends on where the signatures are in the file. If they're at a known location you could use fseek(), fread() and memcmp() to determine if the signature is in the file or not. If the signatures are at a random location, I'd pull the entire file into a malloced buffer (_stat() again), and then search through the buffer. The simple way would be use memcmp() at locations 0 ... (current_file_size - reference_file_size), but there's more efficent ways of going about that. If you know that there's no null chars in the either file (unlikely), maybe strstr() is an option.
some notes on what you have so far:
sizes, and sizes will not change over the while loop, so they could be computed before entering the loop. strlen("\\") is 1, not 2
you not calling free(string) within the while loop, so you're leaking memory. If you use my suggestion about slurping the file into memory, don't forget to free() that buffer too.
First you need to write down the steps you require to do the searching. Something like:
Read 'key' file and extract its signature
For each file in directory
Open next file
Read some data (maybe a small amount, maybe all, or maybe just some specific block)
If the key-file signature is in the data of this file
Do file match processing
Do file no match processing (if necessary)
Until (no more files)
Once you have all the steps clearly defined it should not be too difficult to turn that into code.
A folder in a folder is just a new path to search. When you get a directory in your dirent search, you just append a backslash '\\' followed by the directory name to the string you got from argv (or the current path), and start a new search. Say you start your program by:
and your found entry is a directory named Music, you would create a new path C:\Users\Random\Lists\Music and continue with that. Don't forget to ignore directories named . and .. as they lead back up the tree.
Sorry, but that code does not make any sense. I have no idea what the first block of code is supposed to be doing. And in the code following the flushall call, you have made a call to strlen on a pointer returned from malloc. But the memory that it points to has not been initialised with a string, so the value you get will be either zero, or some random invalid number. You must use strlen on the source string (argv) in order to measure it. So your code should be something like:
int length = strlen(argv) + 1; // extra space for trailing null character
char* entrenceToTheFolderBefore = (char*)malloc(sizeof(char) * length);
for (int i = 0; i < length; i++)
entrenceToTheFolderBefore[i] = argv[i];
You could use strcpy here, but perhaps your teacher has told you not to.
I dont know if i fixed it or not because Just now i saw your comment
but this is how far i got in order to get to the second frole from the first file
but for some odd reason it stopps when i do malloc
Go to ParentNow that I fixed most of the code the last part is which is the loop to find out the name of the second folder
Reminder that The argv has a path to a folder
the program is trying to exit the folder to the fodler before (succeeded)
and now at the last part trying to get the path for the second folder and the file before if it makes any sence
so for some odd reason it doesnt work
the weirder part is when i try to do puts(); on the Dir struct d_name
and it triggers break point
That is what I guessed from looking at all your posts. And that is why I suggested you stop trying random pieces of code, and go and work through some tutorials and reference guides on the basics of C and its run-time libraries. Trying to learn programming from posting questions here is really not a good idea. A few, or many, hours of serious study will serve you much better in the long term.
I have a shared storage pointer with my console application Hercules it is defined as LPVOID most of it is displayable characters but some are just hex characters
When try to construct the string with the following CString constructer
CString mystr((LPCTSTR) mysharedptr,34); tracing it in the visual studio debugger
The code goes off into some MFC code that had an assertion specifically ASSERT(FALSE)
Sorry but you are still not giving us any useful information. What exactly is the content of mysharedptr, and what assertion are you getting? It may well be that a CString is just the wrong class for whatever problem you are trying to solve.
if you need a container to hold chunks of data which might contain a NULL, CString is the wrong container. you can use a std::vector< BYTE > (or a CByteArray, if you like MFC). or you can roll your own.
Well, most data comes down to being bytes... strings just are some set of bytes that are expected to mean something (whether according to ASCII or some other wide character standard)... if you need a generic container, you can't just use something that expects what we'd refer to as a "string".
Hi there, I am new to the programming scene. I am a Digital Forensic Investigator with the Digital Forensic Laboratory at The Directorate For Priority Crime Investigation; within the South African Police Services.
I was recently assigned to do research and analysis on compromised Verifone POS-devices. On some of the devices we do manage to extract data, which is encrypted. I investigated some of the tools the criminals use in the process.
On the malwr.com site the encryption tool PasswordGenerator.exe was uploaded and can be downloaded from there for analysis. This tool uses MACTripleDES PADRight encryption.
Is there maybe anyone that can assist me to create a tool to decrypt the data from the devices. The PWG creates an init.dat file that is uploaded to the POS device which encrypts the data that is captured and then decrypted after being downloaded with The VeriFoneDownloader.exe and then the .vfd-file is decrypted using the VeryFoneViewDataNew.exe. When the correct password is entered and the file decrypted it is saved as a .dfv-file.
All the .exe files are uploaded at malwr.com. I will upload an encrypted and decrypted file as well. (201404221348.vfd and 201404221348.dfv)
If there is anyone that can assist it would be highly appreciated.
Design and implement a class for binary trees, following the specification at the following URL http://www.cs.colorado.edu/~main/chapter10/bt_class.h
Your design should use a dynamic array to hold the data from the nodes in the same way that a complete binary tree is usually represented. However, these binary trees do not need to be complete. Instead, you should have a second private member variable that is a dynamic array of Boolean values called is_present. The is_present array indicates which nodes actually exist in the tree. For example, if the tree has a root node, then location is_present is true. If the root has a left child, then is_present is true. If the root has a right child, then is_present is true.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle