Posts
 
Reputation
Joined
Last Seen
Ranked #439
Strength to Increase Rep
+8
Strength to Decrease Rep
-2
88% Quality Score
Upvotes Received
8
Posts with Upvotes
8
Upvoting Members
7
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
6 Commented Posts
~49.9K People Reached
About Me

Almost Uni Student.

Favorite Tags
Member Avatar for somename

I don't get why you use fgets. If it's an ASCII file, and it should be for the thing you're trying to do, all you need to do is strstr(buff, find) and then memcpy. Not strcpy, in an ASCII file aren't any NULL bytes. Well, not that I know of. …

Member Avatar for deceptikon
0
3K
Member Avatar for JuliaCplus

Sorting any type of data with use of the STL: [url]http://www.cplusplus.com/reference/algorithm/sort/[/url] Which may be a bit too much for 3 strings, but you'll know how to sort 2000 too! :D

Member Avatar for NathanOliver
0
915
Member Avatar for omarelmasry
Member Avatar for homeryansta

[code=cpp] newnode = new Node; newnode = NULL; [/code] Eerrrr? That's a bit of weird code. You're trying to derefence that pointer on the next line! ;)

Member Avatar for sunn shine
0
175
Member Avatar for Clockowl

Hey guys, Here's my story: I had a HDD: Data, ~300GB I created a partition for another OS I'm done with the OS, remove the partition Now, it shows up as unallocated, and I can't find a way to merge it back to the drive it belongs to! A screenshot …

Member Avatar for Rik_
0
150
Member Avatar for jadedman

Here you go: [url]http://www.xmission.com/~nate/glut.html[/url] If you're on windows that is. Else, you need to download glut.h from somewhere else for Linux.. don't know much about linux, sorry.

Member Avatar for od3_85
0
210
Member Avatar for Clockowl

Hey guys, I know the title isn't possible, but I'd like to here how you'd do it then. Suppose we have this code: [code=cpp] Class Foo {public: int x; }; //somewhere in the code.. int main() Foo one, two; one.x = 10; two.x = 20; Foo *a = &one; Foo …

Member Avatar for Narue
0
174
Member Avatar for Clockowl

Hey guys, I have this code snippet: [code=cpp] template <typename ElementType, typename CompareClass> struct Delegate { virtual bool geef(const ElementType &element){ pair <set<ElementType, CompareClass>::iterator, bool> ret; //this is line 196 ret = elements.insert(element); //197 return (ret.second); //198 } virtual void output() = 0; set<ElementType, CompareClass> elements; }; struct ArtiestenPrinter : …

Member Avatar for Clockowl
0
218
Member Avatar for Clockowl
Member Avatar for drjay1627

[code=cpp] #include <cstdio> using namespace std; void testing(const void *buf){ puts((char*)buf); } int main() { char *x = "somebytes"; testing(x); return 0; }[/code] That works here, does that small program also work for you?

Member Avatar for dkalita
0
238
Member Avatar for Clockowl

Hey guys, I'm trying to create an MSCache (2 times MD4) cracker. I took the RFC thingy and implemented it in a cracker which is.. fast, but not as fast as I'd like it to be. So I searched a bit and stumbled on MDCrack, which claims it can do …

Member Avatar for dzhugashvili
0
461
Member Avatar for Zcool31

This might come in handy as well: [url]http://www.cplusplus.com/reference/std/typeinfo/type_info/[/url]

Member Avatar for Zcool31
0
227
Member Avatar for Clockowl

Hey guys, Can I tell istream to ignore ALL the characters until the delimiter char? It can be done with a loop but it's kinda weird I can't tell istream "discard until this char" imho, so maybe there's an hidden option somewhere. Thanks in advance!

Member Avatar for Narue
0
277
Member Avatar for llemes4011

What wildgoose gives as a solution is called a "forward declaration", so you can read up about it (where what why how etc.) And yes, Pancake stacks are most of the time FILO ones. xD ;)

Member Avatar for llemes4011
0
152
Member Avatar for anilopo

You can't call calc() in the product class. calc() isn't implemented in the Product class! ;) What you're doing in the ctor is basically: [code=cpp] Product :: Product (...) { this->price = this->calc (); } [/code] And since "this" in that context is a Product*, you can't call calc().

Member Avatar for ShawnCplus
0
255
Member Avatar for Clockowl

Hey guys, So I have compiled my first home-written static library (named PixGUI) that happens to call OpenGL functions. However, I noticed that when compiling (using MinGWs GCC with Code::Blocks project set to "static library") it doesn't matter whether I supply the linker with libopengl32.a or not, it simply compiles …

Member Avatar for Clockowl
0
202
Member Avatar for Clockowl

Hey guys, Below code isn't working as I expect it to do. I expect it to read all params when 6 are given, buuuuuuuuuuuut it only reads one, the rest remains zero. It does enter the case, but the stringstream buf seems empty. What am I doing wrong? [code=cpp] #include …

Member Avatar for Clockowl
0
165
Member Avatar for Clockowl

Hey guys, What am I doing wrong here? sss.hpp [code=cpp] #include <fstream> #include <string> #include <map> namespace sss { using namespace std; class node { public: multimap<string, string> values; multimap<string, node> children; string &value(const string name, size_t index = 0); node &child(const string name, size_t index = 0); private: template …

Member Avatar for Clockowl
0
684
Member Avatar for Clockowl

Hey guys, How would I partially specilize a template in a manner as below? Is that even possible? I have these two functions: [code=cpp] bool node::read(const char *filename) { ifstream f(filename); if (!f.good()) return false; bool success = read(f); f.close(); return success; } bool node::write(const char *filename) { ofstream f(filename); …

Member Avatar for Clockowl
0
508
Member Avatar for Clockowl

Hey guys, I have a class with a friend function and a member function with the same name. Calling the friend function from the member function gives me an error: it looks for <classname>::<function> while the friend function is of course simply <function>. In this case, MinGW GCC says: [code] …

Member Avatar for Clockowl
0
176
Member Avatar for Clockowl

Hey guys, With this defintion: sss.hpp [code=cpp] #include <fstream> #include <string> #include <map> namespace sss { using namespace std; class node { public: multimap<string, string> values; multimap<string, node> children; string &value(const string name, int index = 0); node &child(const string name, int index = 0); //... }; typedef pair<string, string> …

Member Avatar for ArkM
0
91
Member Avatar for ShadowScripter

Is it a Windows handle, the one in windows.h? It's not an initializer, it's what int and char are: a type. If it's a window handle, it's basically as specific as a pointer. A pointer used by windows to keep track of resources, varying from windows (window handles) to files …

Member Avatar for ShadowScripter
0
104
Member Avatar for jomacho

It doesn't compile in MinGW's GCC. Looks like MSVC code? I'm getting these errors: [code] =| sdvrp.h|18|warning: ignoring #pragma warning | sdvrp.h|222|warning: no newline at end of file| genius.cpp||In function `double genius(route*&, Nb&)':| genius.cpp|732|warning: comparison between signed and unsigned integer expressions| genius.cpp|733|warning: comparison between signed and unsigned integer expressions| genius.cpp|736|error: …

Member Avatar for tux4life
0
125
Member Avatar for Clockowl

Hey guys, I got this code, and I can't get it to compile, no clue what I'm doing wrong. [code=cpp]#include <iostream> #include <vector> #include <iterator> using namespace std; template <class T> void kill_dupes(vector<T> &x){ vector<T> y; for(vector<T>::iterator it = x.begin(); it != x.end(); it++){ if(find(x.begin(), x.end(), *it) == x.end()){ y.push_back(*it); …

Member Avatar for siddhant3s
0
2K
Member Avatar for Stefano Mtangoo
Member Avatar for NicAx64
0
436
Member Avatar for Clockowl

Hi guys, What am I doing wrong here? Program dies on me @ merge(). :( [code=cpp]#include <iostream> #include <vector> using namespace std; int main() { int afrom[4] = {0,0,1,2}; int ato[4] = {1,2,3,4}; vector<int> from(&afrom[0], &afrom[4]); vector<int> to(&ato[0], &ato[4]); vector<int> length; vector<int> all_nodes; sort(from.begin(), from.end()); sort(to.begin(), to.end()); merge(from.begin(), from.end(), to.begin(), …

Member Avatar for Clockowl
0
120
Member Avatar for ihatehumans

Your overloaded >> is a bit complicated, here's a simpler version: [code=cpp]int main() { int nom, denom; string buf; getline(cin, buf); stringstream ss(buf); ss >> nom; //discard all the remaining chars, stop when / is found ss.ignore(ss.str().length(), '/'); ss >> denom; cout << "Read: " << nom << "/" << …

Member Avatar for siddhant3s
0
203
Member Avatar for ShadowScripter

Does this code compile for you? [code=cpp]int main(){ size_t cols = 10; cin >> cols; size_t rows = 20; cin >> rows; char x[cols][rows]; for(int i = 0; i < rows; i++){ for(int n = 0; n < cols; n++){ cout << x[i][n]; } cout << endl; } return 0; …

Member Avatar for ShadowScripter
0
704
Member Avatar for Usura

Tux4life is right, you can't delete one element of an array in C(++). Either use a vector or do as tux4life said.

Member Avatar for tux4life
0
79
Member Avatar for SmokyMo

This'd work. [code=cpp] string filepath; getline(cin, filepath); ifstream fis(filepath.c_str()); [/code]

Member Avatar for tux4life
0
87