825 Posted Topics
Re: Perhaps you can use a [condition variable](https://computing.llnl.gov/tutorials/pthreads/#ConditionVariables). | |
Re: [XML](http://xmlrpc.scripting.com/) is one known way to do this. | |
Re: Yes. There are libraries available to make your life easier. It does, however, depend highly on your target system. | |
Re: In general, pentesting is not about a particular GUI. If you are evaluating a system (or network of systems) from an external point you are generally free to choose your set of tools for the test. This does not excuse you from understanding intimate details of all platforms you are … | |
Re: A local variable is only available within the current scope (usually that means between `{` and `}`). It is a way to write code without having to consider how the underlying memory is being handled but without having to have *every* variable you use at global scope. In general, it … | |
Re: Well, you *can* store pointers to the memory locations of the '\*'s in your code but in order for them to work with other string functions and as you might want them to behave you have to terminate the string with a null character `\0` (this is how `strtok` works). … | |
Re: Why not overload teh access functions to limit them yourself? For example unsigned char operator[](size_t i) { if (i < 0 || i > vector_max) { throw some exception... } return internalVector[i]; } | |
Re: The problem you are having with `pkill` is that, by default, it only checks the process name (`sh` in your case). You can request that it match the entire command line by providing the `-f` flag. Somthing like: $ sh test.sh # In another terminal... $ pgrep test.sh $ pgrep … | |
Re: How about [wstrcat](http://msdn.microsoft.com/en-us/library/ms860384.aspx)? wstrcat (pathbuf, L"file.ext"); | |
Re: **Realize that there are rules/laws governing whether this is legal and to what extent you are allowed to listen to traffic on the network. You should be well aware of these rules/laws before you decide to continue down this path.** Instead of looking for an active solution to interacting with … | |
Re: Yes. In general, in a `lex/flex` file you would provide the tokenizer rules. Something like: %% // ... %% "apple" { return APPLE; } "pear" { return PEAR; } "berry" { return BERRY; } %% // ... Then, in the `yacc/bison` file you would set up the grammar rule similar … | |
Re: Why not have the file version take an `istream` object? Something like: vector< string > Parser (std::istream& in); That way it is clear the intent of the function and you can still use the `string` version without issue. | |
Re: my suggestion is to just start using it. You will quickly run into things you do not understand and consult the internet. Each step will bring you closer to understanding the system as a whole. No book, no matter how well written, is going to enlighten you better than hands-on … | |
Re: `%`, as you've stated is the remainder of a division operation. If you do long-hand division of two numbers, the value you have left at the end of the division is the remainder - this is always a whole number. Consider the following: ___1_ 7 | 12 7 --- 5 … | |
Re: If you need random access to the vector then **deceptikons** answer is what you should consider. However, if you are iterating over the vector sequentially you would be much better off using an iterator. As **pyTony** mentions, it really depends on your situation and application. | |
Re: @CimmerianX: If his application *needs* connectivity this is not an option. `tcpdump` or `wireshark` are two easy to use approaches. The difficulty is knowing which connections are related to your application (your will see *all* connections by default with these tools). If you can watch your application from the system … | |
Re: Are you required to use awk/sed? This would be much easier if you could employ something like perl/ruby/python. In general, the loop body would look something like: if first_line previous_line = current_line continue end if saved_current_line = current_line if previous_line[0..6] == current_line[0..6] previous_line[-2..-1] = "00" current_line[-2..-1] = "00" end if … | |
Re: If all you want to do is avoid the `if/else` blocks you can implement a function call table that is indexed by the `packet_id`. Something similar to: typedef size_t (*gps_fun)(packet_t *, void *); gps_fun parsers[] = { 0, parse_gps_solution, // packet id == 1 parse_gps_error, // packet id == 2 … | |
Re: You can consider `fork` as creating an exact mirror of the executing process. That is, everything that is happening after the fork will also be happening in the created process (unless control flow logic is introduced). Consider the following diagram of your code sample: // Assume process id is 1 … | |
Re: There is not enough context in that snippet to even wager a [i]guess[/i]. As an aside, I see emoticons. Please use code tags. | |
Re: Use `gsub`. First argument is the item you want to change (can be string or regex) the second is what you want to change it to. s = "this 'string' has embedded single 'quotes'" s.gsub("'", '"') # => "this \"string\" has embedded single \"quotes\"" | |
Re: If you want to pipe/redirect the output of tshark to your program then your program only needs to read from standard input (`std::cin`). You will have to be cognizant of the format of the stream you are reading - which will change depending on the flags given to tshark. | |
Re: Unfortunately, `seekg` works on bytes not lines. So you have a few options: * Store the offsets to the beginning of each line (newline + 1) in the file. `seekg` to the appropriate value (10 or less from the end) and read the file from there. * Store each line … | |
Re: In general, you would use one of the `vprintf*` functions to do this. From `man vsnprintf`: > The functions vprintf(), vfprintf(), vsprintf(), vsnprintf() are equiv- alent to the functions printf(), fprintf(), sprintf(), snprintf(), respectively, except that they are called with a va_list instead of a variable number of arguments. These … | |
Re: The physical layer devices are responsible for decoding the raw bit streams from the medium. In general, you can not access the data of the network until it is packaged into frames at the link layer. For that you can look at a tool that uses some form of the … | |
Re: I think you are getting confused about how memory is stored on your system. It is not necessarily the same way you place your values in the union. For instance, notice that 42577 in hex is `0x00a651` while 5350912 in hex is `0x51a600`. Notice the order there? When all three … | |
Re: You need to loop the `chars` array. Something like: for (int i = 0; i < finline.size(); ++i) { cout << hex << chars[i]; } | |
Re: There are plenty of online resources for understand free/malloc implementations. Some of them go as far as step-by-step tutorials. Google for `simple malloc implementation` I would suggest, however, that you start with something easier than brk and sbrk. Why not get things working with a fixed size array (say `char … | |
Re: [Wikipedia article on the subject](http://en.wikipedia.org/wiki/Plagiarism_detection) In particular, you will want to navigate to the `Source code plagiarism detection` section. | |
Re: I'm not sure I understand. Writing to a file is the same no matter the content. In C++ this is accomplished, generally, through `std::cout` via something like: `std::cout << "MOV EBX 10" << std::endl`. Knowing whether a file contains that type of data requires you to parse the file and … | |
Re: `man stat` would help. Something like `stat -c "%y|%s|%n"` would get you close but there is no such thing as creation time in linux (looking around the net I see something called birthtime but I've not seen that supported widely). As far as the label of the medium, I'm not … | |
Re: perhaps add `-Xlint:deprecation` to the compilation options? Also, this is the C++ thread. | |
Re: `A a = new A()` should produce a compile-time error. You can not assign a pointer to a non-pointer type like that. You probably meant `A *a = new A()`. At that point your pointer is just some random memory location. Unless you try to `delete` it you should not … | |
Re: You could use [difftime](http://www.cplusplus.com/reference/clibrary/ctime/difftime/) | |
Re: You can send error output to some specific location (usually, `/dev/null`) So something like: `ifconfig eth0:1 down 2>/dev/null` That will prevent error messages from being printed but will still allow any other output to be printed to the screen. | |
Re: `int* spieler` indicates an array, not an array of arrays. I'd suggest that you change that to be `int **spieler` if you are, in fact, passing in a two-dimensional array. If you are not, then you can not index an int type with `[]`. For type `int *ip`, the following … | |
Re: Two things: * gettimeofday takes a pointer to a struct timeval, you are providing a pointer to a pointer * I do not see anywhere where you include `<sys/time.h>` | |
Re: I believe that `popen` will do what you want. [Here](http://pubs.opengroup.org/onlinepubs/009604499/functions/popen.html) is some documentation with an example at the bottom of the page. | |
Re: The concept of incrementing a linked list is somewhat misguided. Most likely you intend to increment an iterator over the list. The standard library makes heavy use of this concept. To support that you would need to program the interator into your linked list interface. In general, you provide the … | |
Re: [list]This is C++ code, not C code. [*][icode]system[/icode] requires [icode]#include <stdlib.h>[/icode] [*]You have not defined [icode]Encrypt[/icode] [*]You seem to be mixing comments and code without using comment syntax (comments need to be wrapped in [icode]/* */[/icode] or preceded with [icode]//[/icode]) [*]Your [icode]if[/icode] statements are not using brackets [icode]{ }[/icode] so … | |
Re: You want *both* conditions to be true; that requires the && operator. What you are asking is for is for *either* condition to be true (which will always be the case since **answer** can not be both values at the same time). | |
Re: Perhaps the [for](http://ss64.com/nt/for_cmd.html) will work for you. That link has an example of how to split up the output of the `ping` command. | |
Re: I dont understand that question. If you need to send 4 bytes of information then you need 4 bytes of storage. I'm not sure how you expect to get more efficient than that. Could you please explain a little better what it is you are trying to do? | |
Re: I'm not sure why you think that it is inefficient. That is how you delete something from a vector. I would do some checks on the input, however. If the user enters anything less than 1 or greater than the size of your vector you are going to have trouble. | |
Re: Look at putting the code you want executed in [icode]/etc/init.d/[/icode]. That is the traditional location of startup scripts and they are run as root. | |
Re: You can do this directly with a mutex. It is not a signal, but is more suited to synchronizing threads. Example:[code]pthread_mutex_t the_lock = PTHREAD_MUTEX_INITIALIZER; void * thread_fun(void * ignore) { struct timeval tv; pthread_mutex_lock (&the_lock); gettimeofday (&tv, NULL); fprintf(stderr, "thread: %d.%06d\n", tv.tv_sec, tv.tv_usec); return NULL; } int main () { … | |
Re: Try the following:[code]for i in $*; do echo ${i} done[/code] The [icode]$*[/icode] represents the set of arguments to the script. | |
Re: Please don't double post. We will see your first post and reply there, there is no need to post the same question twice in a row. | |
Re: In general, a web browser is the proper choice for viewing HTML. I'd suggest that trying to interposition data streams to a browser is going to be much more difficult than saving the message (in HTML format) to a file and calling a browser from within your program to view … |
The End.