462 Posted Topics
Hey guys I'm having an extremely hard time splitting or combining values into binary.. [CODE] #define Chr(n) ((char)(n)) #define Ord(c) ((int)(unsigned char)(c)) int DecToBin(int Num) { int Bin = 0, Pos = 1; while (Num > 0) { Bin += (Num % 2) * Pos; Num /= 2; Pos *= … | |
How can I make my DLL constantly check for hotkeys but without affecting other functions in it? If I put a loop, it will not be able to get any other calls to functions.. Do I create a thread and pass my functions to the thread upon attachment? My silly … | |
I'm trying to convert this (Pascal) to C++.. My attempt is below this.. [CODE] function CompressString(const Str: string): string; var Destlen:longword; begin result := ''; Destlen :=BufferLen; if length(str) < 1 then exit; if compress(BufferString,destlen,PChar(Str),length(str)) = Z_OK then begin setlength(result,Destlen + SizeOf(Integer)); PInteger(@result[1])^ := Length(str); Move(bufferstring[0],result[5],Destlen); end; end; [/CODE] [CODE] … | |
My code is: [CODE] #include <windows.h> #include <iostream> using namespace std; struct ReplacementFlags { public: bool rfReplaceAll, rfIgnoreCase; ReplacementFlags(bool ReplaceAll = false, bool IgnoreCase = false) : rfReplaceAll(ReplaceAll), rfIgnoreCase(IgnoreCase) {} ~ReplacementFlags() {} ReplacementFlags& operator ()(bool ReplaceAll = false, bool IgnoreCase = false) { if((rfReplaceAll != ReplaceAll) && (rfIgnoreCase != IgnoreCase)) … | |
When do I really need to use Delete in Destructors? if I do Point P = new Point(); I've been told every time I use new, it stays in memory even when out of scope and that I should use delete to remove it.. so do i need to do … | |
I did not know WHERE to ask this as there is no "General" section on the site this site that I know of. Lets say I found code online but it's under the GPL 3 License.. I read it but it doesn't say that I cannot translate it from Pascal … | |
Am I wrong that the answer is 2?? Teacher refuses and says that it's 3 because the compiler spits out 3 for ans.. but if I do it manually with pen an paper or with the cout<<v2%v1++, it spits out 2 which is what I get on paper.. [CODE] #include … | |
How can I check if a template's parameter is empty? Or of a "certain type"? I'd prefer to check if it's empty or not rather than the type because if the wrong type is entered, it'd throw an error anyway.. But I definitely need to know if the parameter passed … | |
Re: After encryption and decryption, it's hard to read back.. what you do is that for each line, encode/decode using base64 as if u don't, sometimes the characters won't be read back exactly how they were.. Had this happen to me before.. so I just used base64 or hexadecimal for each … | |
I'll get straight to the point as it's very difficult to do since I haven't found the answer on google or anywhere else. [CODE] Class ArrayOfTypes { vector<MyType> P; &MyType operator [](int I) = (MyType& PT) { if (P[I] != PT) { P[I] = PT; } return P[I]; } } … | |
Re: I think this is what u meant?? Sorry if it's not and sorry for using double instead of float if it is correct. [CODE] #include <assert.h> #include <iostream> using namespace std; class Vector3D { private: double X, Y, Z; public: Vector3D() : X(0), Y(0), Z(0) {} Vector3D(double X_, double Y_, … | |
Is it Dangerous to Derive from STD? Specifically std::string. Why I'm asking? I want to write a class that extends the functionality of std::string and a couple other std structs/classes.. So that when I do something like: String M = ""; M.Explode(........) it'll do the functionality in my class below. … | |
How can I get a variable amount of arguments in a function without providing how many arguments will be passed? For example, when you use a VA List, the first parameter must be the amount of arguments passed.. I don't want that. I want to just start passing any amount … | |
I have: [CODE] private: Void GoBtn_Click(Object^ sender, EventArgs^ e) { ((WebBrowser)MultiTab->SelectedTab->Controls[0]).Navigate(SearchBar->Text); } [/CODE] But it keeps giving me an error at Controls[0] and telling me that no operator [] matches.. Control::Collection^ [int] <--- No clue what that line means.. Next it tells me that I cannot cast TabControl to (WebBrowser) … | |
How can I do the following? I read up on Variable Arguments last time I asked this question (Mike pointed me in the right direction).. but it still does not let me define any number of them.. I Do not want to specify the first parameter and if I do, … | |
Is there any C++ .Net IDE's around? I mean visual studio is ok.. it just isn't as good as SharpDevelop which only does C#, VB and a few others. It doesn't do C++ that's why I'm looking for a C++ version of SharpDevelop. Any Ideas? SharpDevelop [url]http://www.icsharpcode.net/opensource/sd/[/url] | |
I have: [CODE] class ANew { private: vector<CustomType> ArrayOfTypes; public: ANew() : ArrayOfTypes(0) {} ~ANew() {} ANew& operator ()(int I) { return ArrayOfTypes[I]; } operator const ANew* () const { return ArrayOfTypes; } }; [/CODE] But it gives me these errors: [ICODE]C++\Types.h|12|error: invalid initialization of reference of type 'ANew&' from … | |
Someone please tell me the difference between 0 and '\0' and NULL. I thought I knew it! 0 and NULL is the same thing "Essentially".. '\0' is a null terminator for a string.. It's just sometimes when I convert a string to char array and do some encryption on it, … | |
I read a LOT of tutorials on bitmaps. I learned that RGBQuad is for 32 bit bitmaps and RGBTripple is for 24 bit bitmaps.. I'm planning on getting pixel information from a bitmap that can be of 3 types. 24bit, 32bit, 32bit with alpha (Transparent). Thing is, I don't know … | |
Sorry for using Inception in the title but it's the only way I think I can describe it.. Take this for example: Definition.H [CODE] struct XY { string info; string name; string tag; string attrib; }; //is it better to create an object here inorder to make the array? struct … | |
The below code is what I have.. It's a custom type I made called Points that stores co-ordinates on the screen.. The problem is in the PointsArray Struct. When I declare one like so: [CODE] PointArray P; Point A(10, 5); for (int I = 0; I < 5; I++) { … | |
How can I forward declare a struct/custom type in my include? I'm trying to write an include but it keeps telling me incomplete type or type not declared.. I do not have a .CPP to go with it.. I wrote everything in here as I have never written an include … | |
Re: Well you posted no code.. so how are we supposed to know? | |
In pascal, you can have something like the following: [CODE] type TPoint = record X, Y: Integer; end; TPointArray = array of TPoint; T2DPointArray = array of TPointArray; [/CODE] In C++ I tried to replicate this and failed miserably. [CODE] struct Point { X: Integer; Y: Integer; }; struct PointArray … | |
How can I detect 3D Images? These images rotate in every direction in a game and I want to be able to detect them and click the right ones. Where would I start? I was thinking just loading a lot of bitmaps and somehow making a 3D image of it … | |
Re: Only thing I can think of is the includes that you have.. You need <vector>, <iostream> | |
Why does it load my DLL but the pointer to the Proc returns 0? It loads the DLL and says "DLL Loaded" but it just won't say "Function Found." Help me please :)? [CODE] #include <windows.h> #include <iostream> //DLL Function: void DLL_EXPORT Theading(HANDLE hThread, DWORD ThreadID, void* FunctionToPass); typedef void … | |
Hey all, I'm trying to make a DLL that can be used in Pascal to enable multi-threading. I've decided I want to export Threads in C++ to a DLL. Before I make DLL's I usually write the program first to test everything then I convert it to a DLL. [CODE] … | |
How do interpreters do it? I've seen bots for games that encrypt files then decrypt them at runtime and run what's in them.. Well How? How can I do this in C++? I plan to do this in another language but I decided to ask in C++ section because this … | |
I have an idea for a program but I don't know if its possible. I want to write a program that can read commands from a file.. For example, I've seen bots that can parse and read javascript for games and execute whatever is in the .java file.. How can … | |
Hey all, I'm a c++ programmer and I'm REALLY new to pascal. I want to translate some of my programs into pascal just for the experience. The thing is, this Lazarus compiler is soooo confusing! All the windows are split apart.. How can I join them? Next is how can … | |
My problem is at line 54 and line 124.. Not sure how to fix it at all.. I basically just want to store all the values of NameIdx to the vector and print the values of the vector. But instead if shows random/AltKeyCode characters and crashes. I know its probably … | |
I have a page that has a hidden button at the top. When a link is clicked, the button shows. I want to write javascript so that if the button is showing, add a breakline below it and if it is not showing, do nothing. My attempt & fail is … ![]() | |
I have an iframe that loads a page inside it.. when a link is clicked on the page in the iframe, resize the body of the parent aka the document that has the iframe's body.. Example: [CODE]Body <------------------------ Iframe | Page | Link... Upon Click, resize --[/CODE] How do I … | |
Can someone explain why my function is not working? Description: ToggleFrame(TagID, FrameID).. Given those two, get the two elements.. If the iframe is showing, hide the tagID element.. if the tagID element is showing, hide the iframe.. My attempt & failure: [CODE] function ToggleFrame(ID, FrameID){ //Given the tag, show/hide it.. … | |
Trying to re-write a php function to C++ using boost.. I have NOT seen code for this anywhere on the net. I thought it was useful and I need it for C++ but I need help.. definition of the function in c++ [CODE] void preg(string pattern, string subject, string &matches, … | |
Re: [B]Compiler Search Directories: [/B] C:\Program Files (x86)\curl\include [B]Linker Search Directories:[/B] C:\Program Files (x86)\curl\lib [B] Compiler Defines:[/B] CURL_STATICLIB [B]Link Libraries:[/B] curl rtmp idn ssl ssh2 crypto z ws2_32 wldap32 winmm gdi32 [B]Linker Options:[/B] -static Now compile your program.. It will not give errors. | |
I have a file that has the layout: [CODE] 0 0 0 1 1 0 1 1 [/CODE] I want to read it into a multidimensional array and use the values. The thing is I don't know how to read it in.. I can read the amount of columns and … | |
Re: [CODE] for(int i = 0; i < hash_array[index].size(); i++) //Should be: for(unsigned short i = 0; i < hash_array[index].size(); i++) [/CODE] Also you cannot compare an int to an iterator.. .begin() and .end() are both iterators.. you can actually do something like: for(it.begin(); it.end(); it++) | |
Hey all. I'll make this quick. I want to search for a pattern and replace it with an empty string using the boost/curl libraries OR strictly c++.. No DotNet. The below code I have, removes HTML Tags from a file/string: [CODE] static string StripTags(string source) { int iSize = (int)source.length(); … | |
Hey guys I'm here again with another problem. I want to search in a string for a string with quotes in it. Example: [CODE]String to search = {' </a></div></div></div><div class="clearfix"><table cellspacing="0" class="wsod_quoteData"><tr><td class="wsod_last wsod_lastIndex" nowrap="nowrap" '} What to search for = {' <table cellspacing="0" class="wsod_quoteData"> '} Then if found, from … | |
Hi guys. I have a php script that reads some values off a website and prints to a file every second.. The thing is, the script is always ran in my browser and I don't like that. I want to write a c++ program that can run that script within … | |
Re: Such a stupidly easy program.. I don't see why u wouldn't be able to make it.. took me 5 minutes max to make this.. Of course it can be optimized but I will not do this for you.. Secondly since I'm posting it below and I don't know if it's … | |
I have an iFrame that is 1024px X 700px. I removed the scrollbars using Scrolling="No" because the scrollbars don't look very pleasing to my eyes. I use javascript to scroll the iFrame but for the life of me, I cannot figure out how to detect if I'm already at the … | |
[IMG]http://i.imgur.com/DGegu.png[/IMG] I have that page above.. But the thing is the entire website was made using an iFrame that loads another page.. Each page has one of those at the bottom. Thing is when the main page loads the second page, there are duplicates of those at the bottom. I … | |
Re: What I don't understand is why the teacher would give you such a large project without having taught you the basics! I mean come on.. that project is obviously not a beginner project and yet you who do not know where to even start, has to write that much code.. … | |
Re: You would first have to know how to use bitmaps quite well and take screenshots in C++. You'd then get the raw code of the bitmap and compare it with the image on screen. This might require you to know how to do arrays really well too. Since your going … | |
Re: His question is pretty clear to me.. He wants a menu in his program and when a user presses "M", the menu shows/hides itself. The user can press "M" at any time during execution. Doesn't matter where in the program they press it.. I would do something like: Create a … | |
I have a game client that has a button to allow input and when toggled on it will block input.. Thing is sometimes even when u toggle it off, it still blocks user input.. Other times there is an extremely HUGE delay before it accepts input.. I was thinking if … | |
Re: [CODE] <include FormName.h> Form1::Visible = false; FormName ^ Form2 = gcnew FormName(); Form2->ShowDialog(); [/CODE] That should be more than enough.. It's what I use.. If u made your form2 in the same project as Form1.h then just include the Form2.h file in the first form.. that way u don't need … |
The End.