825 Posted Topics
Re: This is known as [url=http://en.wikipedia.org/wiki/Glob_(programming)]file globbing[/url] and has slightly different behavior than regular expressions. | |
Re: Which part are you having trouble with? | |
Re: To expand on what [b]gerard4143[/b] mentioned, [icode]gcc[/icode] has the option [icode]-Xlinker [i]option[/i][/icode] that allows you to pass options through to the linker. | |
Re: (I'm assuming Linux here) You can write code to get notifications when there are [i]modifications[/i] to a directory but I don't know of a way to get notifications when someone [i]enters[/i] it. Though, what would be the point? If you are concerned with those who saw what was in there … | |
Re: Use the modulus operator and division by 10 in a loop. Modulus will give you the least significant single digit of the number division will 'right shift' the value by one digit. | |
Re: [icode]char * str = "some string";[/icode] creates an immutable variable. [icode]char str[] = "some string";[/icode] creates a mutable one. | |
Re: [QUOTE=Greywolf333;1646712]Your instructor means for you to use double.[/QUOTE] Unless the exercize is to expose certain limitations of each format. [icode]sizeof(float) : 4 sizeof(double) : 8[/icode] | |
Re: [QUOTE=deni_bg;1646646]I would like to know what will happen after deleting the green row and what problems might appear[/QUOTE] That file will cease to exist. Anything that depends on that file will no longer be able to satisfy dependencies. | |
Re: We have a C++ forum [url=http://www.daniweb.com/software-development/cpp/8]here[/url]. You should post there. Perhaps a mod will move this in the meantime. For your question: a set of ordered choices is a logical mapping to an array (or vector). Maybe you could set up a menu and store choices in the array... | |
Re: Are you sure what you are trying to do is legal? | |
Re: In general, this type of thing is done with a markup format. XML and JSON are two common ones with well-known parsers written in C++. | |
Re: You can not charge a user money. You can, however, ensure that what they input matches what you require. Read [url=http://www.daniweb.com/software-development/cpp/threads/353627]this thread[/url] for a decent set of examples. | |
Re: I eventually want a co-worker who knows how to solve his own problems. Seems we are at an impasse. If you would like help with a particular problem you are having, please post your code and a question. However, no one here is going to do your homework for you. | |
Re: From [b]man qsort[/b]:[quote][code]SYNOPSIS #include <stdlib.h> void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, const void *)); DESCRIPTION The qsort() function shall sort an array of nel objects, the initial element of which is pointed to by base. The size of each object, in bytes, is specified by … | |
Re: The general approach to this type of problem is to collect packet captures (tcpdump, wireshark) and post process them at a later date. You also mention 'request/response' behavior. What level? The transport layer? Application layer? There are wildly different behaviors at each. | |
Re: There are plenty of examples of small shells on the net - try google. I've seen them implemented in anything from C to Ruby/Python so it really boils down to what you are comfortable using. | |
Re: Ignoring details such as packing, endianness, and pointer issues the most basic approach is something similar to the following [code]template <typename T> inline void pack (std::vector< uint8_t >& dst, T& data) { uint8_t * src = static_cast < uint8_t* >(static_cast < void * >(&data)); dst.insert (dst.end (), src, src + … | |
Re: Perhaps you are looking for a [icode]const[/icode] member rather than a [icode]static[/icode] member? Something like:[code]#include <iostream> struct Event { static int next_id; const int eid; Event () : eid(++Event::next_id) {} }; int Event::next_id = 0; int main () { Event e1, e2, e3, e4; std::cout << "e1: " << e1.eid … | |
Re: [QUOTE=moonray;1607992]actually i need a c++ framework for improving performance[/QUOTE] Performance of [b][i]what[/i][/b]? If a program is I/O bound then your C++ library wont help that very much. Instead of listing the technologies you are required to incorporate try explaining what it is you hope to accomplish and how much work … | |
Re: By the time you use [icode]Test.keydata[/icode] it has already been initialized. If you want [icode]Test[/icode] to take values on initialization you could do something like[code]union tTest { unsigned char keydata[4]; struct tMember { unsigned char a; unsigned char b; unsigned char c; unsigned char d; } Member; } Test = … | |
Re: In general, determining if something is full requires you to have a fixed size of storage. Once what you are storing consumes the available storage the container is full. Check the count of how many things have been inserted into your stack against the size of the internal container of … | |
Re: Any reason you can't use the answers you've gotten on the other forums you spammed this to? | |
Re: You can write email messages directly. I'd suggest using a scripting language (Ruby, Python, Perl) they all have facilities to both manage time (day of the week) and SMTP (for constructing email messages). | |
Re: The [icode]goto[/icode] allows you to jump to a tagged location in your code. If you set up a tag ([icode]error:[/icode] in your case) then [icode]goto error;[/icode] moves execution directly to that location. Nothing prevents that location from being in some other execution path as well. If you've got some conditional … | |
Re: In general, there are command line utilities for this specific to each system [icode]route[/icode] on linux/windows, for example (although very different considering the same name). Writing this in C++ would require that you plug into the networking internals of your particular system making it non-portable. The best you might achieve … | |
Re: If you don't get an error code as a result of accept and you want to check connected status, try a read on the socket and check for errors. | |
Re: If the client is entering the numbers it doesn't matter what you assign to them initially. If the client is only entering a single number then I expect that you know what you want to check that against so you can just assign [i]that[/i] to the other variable. | |
Re: You can also think about [icode]strtol[/icode] as a way to parse known good input. | |
Re: I'm not sure if there is one that exists but try to use a sleep call with microsecond precision instead of millisecond. You will be able to have a finer control over the period. However, there are issues with this. Usually, you are not guaranteed to have an exact sleep … | |
Re: In many cases threads complicate matters before they solve them - especially if you are unfamiliar with threading in general. Why not have some discrete concept of time where you invoke each behavior at each step? Something like:[code]while (true) { has_input = check_for_input if (has_input) apply_input do_controlled_car do_random_cars }[/code]This way … | |
Re: [url=http://www.r-project.org/]R[/url] is an incredibly powerful language specifically designed for statistical work. It is completely free and open source with a huge repository (CRAN) of useful packages. There is integration directly with C++ with Rcpp - and various others - but this has the most traction I've seen. Documentation [of R] … | |
Re: [QUOTE=leghorn;1621003] .. so this better be good[/QUOTE] While I understand your position, the responsibility of choosing a topic rests on you. I could point you at any number of things that interest me but in the end, if they did not interest [i]you[/i] it would be a waste. Dedicating a … | |
Re: There will likely be the same amount of code in any structure you devise. Te difference is that it will be stored in various arrangements so as to not ugly up a single function scope. If a switch is what your program calls for it is probably better to stay … | |
Re: [url=http://www.cplusplus.com/reference/algorithm/sort/]std::sort[/url] and [url=http://www.cplusplus.com/reference/algorithm/partition/]std::partition[/url]. | |
Re: Assume that [icode]sizeof(Header)[/icode] is 20. You call [icode]malloc(100)[/icode] and [icode]nunits[/icode] is evaluated as: [code] nunits = (100 + 20 - 1) / 20 + 1 nunits = (119) / 20 + 1 nunits = 5 + 1 nunits = 6[/code] That is the amount of space (in terms of header … | |
Re: Instead of opening and closing the file in a loop, why not just [icode]rewind[/icode] the file (this will require you to use C-style IO) I'm not convinced that that is your only bottleneck but I have not looked very hard at your code either. Are you sure that that is … | |
Re: Two things: To expand on what firstPerson mentioned, I always find it more descriptive to write functions that take an equivalent type like:[code]bool Word::operator==(const Word& that) const { return this->_word == that._word; }[/code]It helps keep explicit the relationship between the two types even though the [icode]this[/icode] is redundant. Also, when … | |
Re: There are a wealth of tools available for monitoring the health of a network. More than can be listed here, in fact. I'd suggest you use google to search for any of: [list][*] linux network monitoring tools [*] linux sysadmin network tools [*] wireshark, tcpdump, ntop, snort[/LIST] | |
Re: Before trying to ssh to the machine, first see if you can ping it. If you can not ping it then the problem is not an ssh problem, but a routing problem. If you can not reach the remote host you need to look at any of your routing tables, … | |
Re: There are tools to interface with the X11 windowing system although I'm not sure how much GNOME relies on that anymore. You may look at [icode]xev[/icode] to snoop on the things you want to use and map that to generated calls of your own. If you [i]can[/i] use X11, look … | |
Re: Well, considering you will need to learning something in either case it might be worth your while to learn something directly suited to this type of behavior. For instance Ruby, Python, or Perl are all easier to use as a newcomer when parsing text; AWK and shell not so much … | |
Re: Consider how you want to use the class. Do you want to construct the object with a specific XML file similar to [icode]Object("some_file.xml")[/icode]? Or do you want to map a file to the object through a public member like [icode]obj->load_config ("some_file.xml");[/icode] Nothing is stopping you from from providing the public … | |
Re: Just a picking nits, but [icode]USE_NON_STANDARD_CLS[/icode] is pretty useless if you are using [icode]#include <windows.h>[/icode]. I cant comment otherwise as I do not have access to a Windows machine currently. | |
Re: You can use either [icode]ver[/icode] or [icode]systeminfo[/icode] NOTE: Each of these is a command-line tool so you would use them at the command prompt | |
Re: When you pass a variable to a function as you have declared you are dealing with a [i]copy[/i] of that variable within the body of the function. If you want to be able to modify the passed in variable you will need to pass a pointer to it. Something like … | |
Re: [icode]#include "C:/includes.h"[/icode] will copy the text of the file [icode]C:\includes.h[/icode] into your source file at that point. The [icode]#include[/icode] mechanism is a way to do that. You can either specify the files between [icode]<>[/icode] - where the file must reside in a well-known path, or between double-quotes where the fully … | |
Re: [url=http://linux.die.net/man/3/srand]documentation[/url] The [icode]char a = ant;[/icode] is only valid if [icode]ant[/icode] is a character defined at some other location (unlikely in your code example). A [icode]char[/icode] variable can only hold values of a single character ([icode]'a', 'b', 'c'[/icode] for example). In your case it might be better to investigate enumerations … | |
Re: Any reason you can't use standard facilities? For example:[code]#include <iostream> #include <vector> #include <algorithm> struct Equals { Equals(int x) : v_(x) {} bool operator() (int x) { return v_ == x; } int v_; }; int main () { std::vector< int > items; for (int i = 0; i < … | |
Re: Instead of [icode]using namespace std;[/icode] you can [icode]using std::cout;[/icode] and you can now use [icode]cout[/icode] instead of [icode]std::cout[/icode] without pollution the current scope with an entire [unused] namespace. There are subtle errors that are introduced (especially to the inexperienced) when defaulting to [icode]using namespace std;[/icode] If you are interested in … | |
|
The End.