I want to write a program to do something whenever a certain type of file appears in a certain directory. What's the best way to do this?
Do you have to poll the directory to detect the change? ...
Type: Posts; User: brooksbp
I want to write a program to do something whenever a certain type of file appears in a certain directory. What's the best way to do this?
Do you have to poll the directory to detect the change? ...
Duplicates don't matter. So yes the function should return true on abccd/abcdd.
Yeah. It just so happened that the last test case I ran was testing for a positive match.
Anymore...
This seems to be slightly slower on a few trials, but less bloated and prettier :) Thanks for that!
Yes. Can anyone find a faster way to do this?
Create an algorithm that checks whether two strings have the same characters (duplicates don't matter). Assuming a char == 1 byte so there are 2^8 = 256 possible characters.
Function prototype...
..."right" meaning arithmetically right...
In python: 1073741824 * 2 = 2147483647 this is arithmetically correct.
Why does the above C program even compile? Let alone produce that output?
#include <stdio.h>
#include <math.h>
int main()
{
int i = 1073741824ul;
int total = i + i;
printf("%d", total);
...
cool. thanks citizen. I really hate having to use nasty pointer arithmetic... sucks when you can't model or express functionality using formal constructs...
So I would like to know how a pointer acts based on its type.
char *ptr; /* char == 1 byte */
So say the memory looks like this; and the pointer points to the byte of memory indicated with...
Looks like I'll have to end up with that implementation. Wish C allowed dynamic structures like described above.
Quick little structure organization problem. Basically revolves around how do you define a set of structures with optimal memory layout for networking purposes; set as in, dynamic fields in a...
okay. I actually misinterpreted the semantics of the code. I was actually told to use
uchar hash_code[0];
as a pointer, and then use that to malloc 128 bits. Apparently it's more proper...
Hi,
I'm implementing a custom network protocol in C that contains a header and numerous TLVs. Does anybody have any example code for how to implement TLVs in C? What types of structures/unions,...
Hi I need a 128 bit int-like data type. I was told to use code like this:
uchar hash[0];
Apparently the compiler will know it's 128 bits at compile-time? Anyways, what's the most elegant...
I just don't understand why it wont recognize the heap functions even though heap.h is included????
brooksbp@brooksbp-laptop:~/csci2270/assign5$ g++ studentDemo.cxx -o test
studentDatabase.cxx:...
Still doesn't work. Spits out about 75 more lines of errors
nah.... that produces->
...or... is that the right way to compile it, and those are all bugs? If so, how do i dereference a pointer to a class and call the member function... like...
Okay. Fairly complicated program involving templates, classes, and a driver program. All files are within the same directory. Pretty damn sure that all functions are defined and declaired... just...
Thanks Daved. That was exactly the solution I needed.
In my case I had to change the return type of getItem() to be a non-const reference. It makes sense to use get and set functions for this,...
Yeah... I can't change multiply. It would be nice if I could and then use setItem() like you suggested.
True on the return type. Just making sure it executes correctly.
I wouldn't know. Most likely not.
But, the Process takes a reference parameter ->
void multiply(int& n, int b)
{
n = n * b;
}
template <class Item, class Key>
class heapnode
{
public:
heapnode(const Item& init_data = Item(), Key init_key = Key(), heapnode* init_left =...
Style advice bro... I and others would prefer reading code comparing pointers to NULL rather than 0 which could be quickly overlooked as an int esp if you haven't seen the variable name declared as a...
google "reheapification for binary trees"
don't remember all the properties off the top of my head, but both of your reheapifications look correct. Keep in mind that whether you use left subtree...
Can't find the error yet, but you might want to check pointers for NULL rather than 0. Also, theBase isn't really defined anywhere. I assume it's a global pointer to the base...?
Also when you're...