3,183 Posted Topics
Re: I got my list from elsewhere but these are my fall likelies: * Strike the Blood * Yowamushi Pedal * Super Seisyun Brothers * Log Horizon * Meganebu? * Diabolik Lovers * Yuusha ni Narenakatta > Log Horizon (SAO knock-off or SAO done right? Let's bet...) Total knock-off, and everyone … | |
Re: Have you tried anything at all yet? This is a straightforward loop. | |
Re: That's an old dialect of C++ and doesn't use any difficult to convert features. You need to do three things: 1. Change `cin` to `scanf` function calls. 2. Change `cout` to `printf` function calls. 3. Add a `typedef` to your structure so that the `struct` keyord isn't required: typedef struct … | |
Re: For a quick and dirty sleep, that's fine (though not strictly portable). But note that a busy loop will consume vast CPU resources whereas a platform provided sleep typically puts the process/thread truly to sleep so that other processes can get a turn. The great differences in how an OS … | |
Re: What have you tried so far? And please don't say "I don't know how to start", because that's an extremely lame excuse. Anyone with a passing familiarity with C++ should be able to write this as a starting point: #include <fstream> #include <iostream> int main() { ifstream in("myfile.txt"); if (in) … | |
Re: Just with `strtok` would be problematic. However, you can use `strtok` to split the string on `&` like this: A1.1*7.1 9.1 11.1/ Then manually parse each token to get the ranges. For example: char s[] = "A1.1*7.1&9.1&11.1/"; char *tok = strtok(s, "&"); while (tok != NULL) { char *sep = … | |
Re: Why not just keep it simple? int vowels = 0; int other = 0; for (int i = 0; myarray[i] != '\0'; i++) { switch (myarray[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': ++vowels; break; default: ++other; break; } } cout << "Vowels: " << vowels … | |
Re: How was my previous answer to this question insufficient? | |
Re: > Why is accessing data in an uninitialised array undefined behaviour? It really depends on where the array is defined. If it's a local array then it's undefined behavior just as accessing an uninitialized variable is undefined behavior. The contents of the array are indeterminate, which is the "official" reason … | |
Re: Please post your web.config file. Feel free to censor user names, server names, and passwords. It looks like the connection string is malformed for the information you've already provided. | |
Re: Two things: 1. String literals don't span lines. Provided there's nothing in between, you can make each line a string literal and they will be automatically concatenated onto one: fprintf(fp, "char out[8];char cur[8];" "char con[255, 255, 255, 255, 255, 255, 255, 255];\n" "if cur == con out == 0, 0, … | |
Re: > From what I understand set() creates a column that will hold something less than it's size, and << right or << left will justifiy it. Correct. But note that with the modifiers, typically they only affect the *next* item in the chain, not all further items. | |
Re: Deleting and modifying a file's contents in-place can be tricky. The general recommended approach is to read the file, write to a temporary file with the appropriate changes, delete the original file, then rename the temporary. the benefit of this approach is that it's simple reading and conditional writing. For … | |
Re: Why would every different shop have the same inventory? ;) But to answer your question, look into making the vector a static member of the base class. Then it will be shared across the board. | |
Re: I'd start by breaking down the line into something more manageable: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct definition { char *key; char *datestamp; char *value; } definition; definition parse_definition(const char *s) { char *copy = _strdup(s); // Make a copy for strtok char *tok = strtok(copy, "#"); definition … | |
Re: The two headers are completely different. `cstring` is inherited from C and provides functions for working with C-style strings (arrays of char terminated by `'\0'`). `string` was born in C++ and defines the `std::string` class along with its non-member functions. `strcmp` works like this: int strcmp(const char *a, const char … | |
Re: `||` has lower precedence than `&&`. To get the appropriate behavior (granted I'm assuming what behavior you want), you need parentheses: (gps == 'Y' || gps == 'y') && (childseat == 'N' || childseat == 'n') | |
Re: Consider a simple linked list [insertion sort](http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx#insert). Instead of a direct comparison with relational operators, look at using `strcmp` on the `data` member instead and you'll be good to go. | |
Re: It comes on a DVD. Just make sure that your BIOS is set to boot from CD/DVD and restart with the DVD in the drive. | |
In my job I tend to write a lot of Windows services. Due to this I've pared it down to bare essentials so that the code is as simple as possible, but still fully functional for the needs of each service. What this generally means is I *don't* use the … | |
Re: > Hello, this would be my second time in posting a question which I solved by myself. Well done. Being able to solve your problems yourself is a great ability to cultivate. Unfortunately, a lot of people will ask a question and then stop working on it in the hope … | |
Re: [QUOTE]I need to know which of these three copies of code is considered best.[/QUOTE] const variables are preferred over macros because their names aren't lost during preprocessing. One of the biggest problems with macros is difficulty in debugging code where a macro is involved. Making const a compile time constant … | |
Re: Go to your control panel, then enter `Control Panel\Appearance and Personalization\Display` into the address bar. Make sure the scaling level is set to 100%. When I upgraded to 8.1, it had it defaulted to 125% and your issue sounds like the one I was having. | |
Re: Classic. Your link is broken though. ;) | |
Re: Also note that your thread titles are very uninformative. | |
Re: > You're probably one of the most unpopular posters DW has ever had. I can think of a few that would vie for that title, but they gave up fairly quickly long before voting was introduced. | |
Re: You may want to do some research on the OpenXML file format, it's not as simple as raw text. For something like this I'd look for a library that extracts Word files and then place the (hopefully) formatted text in my control. Aspose.Words is a good library for this that … | |
Re: > it's int main(), never void main() because main() always returns an integer back to the operating system. Except when the program is freestanding and not hosted by an operating system. But if you're writing a freestanding program, you're probably not asking for help on a place like Daniweb. ;) | |
Re: Little do they know that we geeks don't let mere holidays keep us from Daniweb. ;) | |
Re: > which would mean stable_sort would arrange those string with the same length in alphabetical order, is it? No, stable_sort would retain the *original order* of those strings with the same length. | |
| |
Re: "Help" does not mean "do it for me". Post your code, ask a real question, and stop appearing as if you're trying to cheat on your homework. | |
Re: > What is the general way of changing the user account under which the application is running? The general way is to restart the application under elevated privileges: Private Sub ElevateMe() Dim proc As new ProcessStartInfo() proc.UseShellExecute = True proc.WorkingDirectory = Environment.CurrentDirectory proc.FileName = Application.ExecutablePath proc.Verb = "runas" Try Process.Start(proc) … | |
Re: > Please help me ........ With what? All you did was post a homework assignment verbatim. | |
Re: What you're asking is nonsensical. You want `var1` and `FUNC` to have file scope, yet still be visible in other files. Why? My guess is that you're confusing how `static` is overloaded and want semantics that are actually already there with `extern` functions and variables. It might help to explain … | |
Re: > My C/C++ classes swore by passing by reference as a good coding practice, and I have passed even primitive values by reference for a while now. Even in C++ it's a tradeoff. The size of a reference versus the size of the object being passed relative to the cost … | |
Re: You're opening your file in `"a+"` mode. This *doesn't* mean there's a read position and a write position. The file position is initially at the beginning of the file for reading, but the instant you do a write, the position is set to the end of the file. Subsequent reads … | |
| |
Re: > If you have VS you can also connect to a database via the Data menu. Maybe I just have an old school mentality, but I've *never* handled database connections or data through the Visual Studio UI. I've always done it from straight code. | |
Re: Sounds illegal or at least against someone's EULA. We don't allow discussions of that nature. | |
Re: I'd recommend against that, actually. It makes managing the connection harder. Also, many database servers will support connection pooling to eliminate the performance cost of creating, opening, and closing a connection for each transaction. | |
Re: > It was more like, "Normally Daniweb users are able to help their users so why can't you help out like them"and so on... It wasn't like, "SO is #### so join Daniweb!" I can't see how *that* could go wrong, given the pissy tendencies of many SO regulars. :rolleyes: | |
Re: > `strcpy(ptr->name, s);` strcpy(ptr->name, s.c_str()); However, be very careful that the length of `s` doesn't exceed the bounds of `ptr->name`. The ideal (aside from using `std::string` for `name` in the first place) is to make `name` a pointer and allocate memory appropriately: node *ptr = new node; ptr->name = new … | |
Re: > The problem is when I login, it would only read one record. That's exactly what you tell it to do. Technically, your file reading loop in `login` is pointless because the first iteration returns from the function in all cases. I suspect you intended to return 0 only if … | |
Re: > My books show - and > but neither of them seem to apply. The books don't seem to show both together. Strange books. `->` is a single token, and should at the very least be mentioned in the precedence table for operators. | |
Re: The reference is System.ComponentModel, `MarshalByValueComponent` is a class in the namespace. | |
Re: Please post the contents of `my_global.h`. |
The End.