825 Posted Topics

Member Avatar for ricardo.crudo

Perhaps you can use a [condition variable](https://computing.llnl.gov/tutorials/pthreads/#ConditionVariables).

Member Avatar for L7Sqr
0
213
Member Avatar for Sanchixx
Member Avatar for XodoX
Member Avatar for XodoX
0
167
Member Avatar for vijivenkat

Yes. There are libraries available to make your life easier. It does, however, depend highly on your target system.

Member Avatar for vijivenkat
0
117
Member Avatar for MasterHacker110

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 …

Member Avatar for L7Sqr
0
209
Member Avatar for on93

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 …

Member Avatar for L7Sqr
0
150
Member Avatar for SCass2010

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). …

Member Avatar for L7Sqr
0
2K
Member Avatar for triumphost

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]; }

Member Avatar for mike_2000_17
0
216
Member Avatar for srinivas88

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 …

Member Avatar for L7Sqr
0
221
Member Avatar for Suzie999

How about [wstrcat](http://msdn.microsoft.com/en-us/library/ms860384.aspx)? wstrcat (pathbuf, L"file.ext");

Member Avatar for Suzie999
0
213
Member Avatar for daniahmed

**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 …

Member Avatar for L7Sqr
0
625
Member Avatar for binningen

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 …

Member Avatar for L7Sqr
0
159
Member Avatar for phorce

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.

Member Avatar for phorce
0
187
Member Avatar for JoHn_DoE101

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 …

Member Avatar for L7Sqr
0
214
Member Avatar for lewashby

`%`, 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 …

Member Avatar for TrustyTony
0
174
Member Avatar for merse

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.

Member Avatar for L7Sqr
0
126
Member Avatar for 9tontruck

@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 …

Member Avatar for L7Sqr
0
173
Member Avatar for farawaydsky

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 …

Member Avatar for L7Sqr
0
115
Member Avatar for spetro3387

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 …

Member Avatar for L7Sqr
0
95
Member Avatar for XodoX

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 …

Member Avatar for Lucaci Andrew
0
261
Member Avatar for MastAvalons

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.

Member Avatar for Topiary
1
211
Member Avatar for Ritesh_4

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\""

Member Avatar for Ritesh_4
0
141
Member Avatar for ktsangop

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.

Member Avatar for ktsangop
0
973
Member Avatar for Sendy Hipo

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 …

Member Avatar for Sendy Hipo
0
1K
Member Avatar for dippyes

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 …

Member Avatar for deceptikon
0
134
Member Avatar for Majestics

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 …

Member Avatar for DeanMSands3
0
322
Member Avatar for triumphost

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 …

Member Avatar for L7Sqr
0
141
Member Avatar for MasterHacker110

You need to loop the `chars` array. Something like: for (int i = 0; i < finline.size(); ++i) { cout << hex << chars[i]; }

Member Avatar for MasterHacker110
0
727
Member Avatar for alaa sam

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 …

Member Avatar for alaa sam
0
317
Member Avatar for swissknife007

[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.

Member Avatar for L7Sqr
0
241
Member Avatar for triumphost

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 …

Member Avatar for mike_2000_17
0
308
Member Avatar for dwlamb

`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 …

Member Avatar for L7Sqr
0
384
Member Avatar for Tuz

perhaps add `-Xlint:deprecation` to the compilation options? Also, this is the C++ thread.

Member Avatar for TrustyTony
0
88
Member Avatar for jerryjerry

`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 …

Member Avatar for L7Sqr
0
241
Member Avatar for sharath_137
Member Avatar for L7Sqr
0
59
Member Avatar for srinivas88

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.

Member Avatar for L7Sqr
0
313
Member Avatar for tischn

`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 …

Member Avatar for L7Sqr
0
308
Member Avatar for rmbrown09

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>`

Member Avatar for L7Sqr
0
1K
Member Avatar for enkitosh

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.

Member Avatar for enkitosh
0
267
Member Avatar for capton

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 …

Member Avatar for capton
0
198
Member Avatar for doma18

[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 …

Member Avatar for doma18
0
146
Member Avatar for while(!success)

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).

Member Avatar for while(!success)
0
170
Member Avatar for griffman99h

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.

Member Avatar for L7Sqr
0
308
Member Avatar for johans22

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?

Member Avatar for L7Sqr
0
78
Member Avatar for NinjaTwinkie13

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.

Member Avatar for NinjaTwinkie13
0
156
Member Avatar for dinesh17

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.

Member Avatar for JeoSaurus
0
185
Member Avatar for vedro-compota

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 () { …

Member Avatar for vedro-compota
0
382
Member Avatar for laalesh

Try the following:[code]for i in $*; do echo ${i} done[/code] The [icode]$*[/icode] represents the set of arguments to the script.

Member Avatar for laalesh
0
84
Member Avatar for laalesh

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.

Member Avatar for L7Sqr
0
68
Member Avatar for jonnyboy12

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 …

Member Avatar for thines01
0
174

The End.