1,118 Posted Topics
Re: Pattern recognition and image analysis is a complex subject. You are better-off hiring someone to do it. Good luck! | |
Re: No. The kernel is write-protected and you have to know the right magic to get past that. [i]Deliberately[/i] crashing the kernel isn't funny. It is downright dangerous. You can utterly destroy your system and loose data. | |
Re: The documentation for [b]rename[/b]() plainly states that if a file with the new name already exists, results are implementation-defined. You are better off deleting any existing 'new name' file first. The problem with eof() is more insidious. Imagine what would happen to his code if an error flag were set … | |
Re: First off, you are being a bit pushy. Stop. Sometimes it takes a day or two to get a (useful) answer. Secondly, if you can't use C++, then you are posting in the wrong forum. A good DLL to play around with is C:\WINDOWS\system32\comdlg32.dll. You can use the functions in … | |
Re: It isn't a bug. Free Pascal is a little more strict about certain things than TP. Your program should read: [code=Pascal] program fred; type funcparam=function(x:real):real; function jim(x:real):real; begin jim:=x end; procedure bill(func:funcparam); begin writeln(func(3):5:2); end; begin bill(@jim); { Notice that I am getting the address of the function 'jim' } … | |
Re: Wait... this is marked as [b]solved[/b]? Console programs [i]can[/i] have any and all of the same resources as Window GUI programs, but they typically aren't built with them. On Windows, EXE, DLL, OBJ, and a few other files are all the PE32 file format. For MinGW users in general, you … | |
Re: printf() and cout both send data to the same place. C++ only knows of the standard input, output, and error channels, and any other files/sockets/devices/etc. you explicitly open. If you want to display things differently on Windows, you have to go through the Win32 API. For example: [code=C++] #include <windows.h> … | |
Re: I think the OP is interested in unbuffered input. Win32: use <conio.h> stuff ([sub]me goes to wash my hands[/sub]) or the [B][URL="http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx"]Win32 Console Functions[/URL][/B] to set the input console mode to 0 and read a single key. (Don't forget to restore the console mode to what it was before!) You … | |
Re: You can't. The [b]main[/b]() function is, by definition, the first function your program runs. What difference does it make? Just call your function first thing in main: [code=C++] int main() { my_init_func(); ... [/code] Hope this helps. | |
Re: What version of TP are you using? My TP4 wouldn't get past the 8+ letter filename. First, you are forbidden to use reserved words as identifiers. That means [B]unit[/B] and [B]in[/B] are off-limits. You must then go through and fix all the syntax errors. (Watch the ',' in your [b]write[/b] … | |
Re: Since no one is responding to this... I have always found the TTrackBar to be a bit cluncky. You can write your own from scratch (which I usually do), or simply derive a new one where you implement the OnMouseUp method, or (most simply) just check to see if the … | |
Re: Your assignment is the kind of exactingly vague description I've come to expect from CS instructors. Do you have an exemplar of the input file? I will assume some things from here on: A bit string is more commonly called a binary number (integer types). Hence, the number "10" is … | |
Re: Use [B][URL="http://translate.google.com/translate_t#"]Google Translate[/URL][/B]. | |
Re: Yes, you really are asking an OS and SDK-dependent question. If you are using something like SDL, then respond to the key events that SDL gives you. Most GUI/graphics toolkits will give you a way to hook into keyboard events. If you are using straight Win32, look for WM_KEYDOWN events … | |
Re: Good grief. Only use [b]TerminateProcess[/b]() to kill the unruly. Otherwise, just ask it nicely: send it a WM_CLOSE message. If it doesn't respond in, say, 500 ms or so, use [URL="http://msdn.microsoft.com/en-us/library/ms682437(VS.85).aspx"][b]CreateRemoteThread[/b]()[/URL] and [URL="http://msdn.microsoft.com/en-us/library/ms682658(VS.85).aspx"][b]ExitProcess[/b]()[/URL]. If it still doesn't quit after another half-second or so, [i]then[/i] swat it with [b]TerminateProcess[/b](). Hope this … | |
Re: Unfortunately, Delphi really doesn't have very good support for Unicode. Widestrings really only exist for compatabilty with OLE objects... Lately I've been learning a lot about using Unicode in my applications (both Delphi and C++) too, and it is a big, messy world. [B]MSDN [URL="http://msdn.microsoft.com/en-us/library/ms776440(VS.85).aspx"]Unicode and Character Sets[/URL][/B] [b][URL="http://www.inter-locale.com/whitepaper/DelphiI18NCookbook.html"]The Delphi … | |
![]() | Re: You'll need to create a system snapshot and walk the processes and modules. [B][URL="http://msdn.microsoft.com/en-us/library/ms686837(VS.85).aspx"]MSDN Tool Help Library[/URL][/B] If you don't need to do it programmatically, you might want to check out Cedrick Collomb's [URL="http://ccollomb.free.fr/unlocker/"][b]Unlocker[/b][/URL]. If you are trying to dink with system DLLs, there is a reason they are protected. … |
Re: You won't get any source... and you'll have to read your textbook, but think for a moment: Should objects in shared memory be referencing things in the private memory of any process or thread? Hope this helps. | |
Re: This is one of those perennial questions... [b]system[/b]() returns the exit code of the command shell (probably [b]bash[/b] --or if your system is really old, [b]sh[/b] [check your /usr/bin/sh to see if it is a link to bash or not if you want to know]). Only if your libc was … | |
Re: I would not hire you if I saw that code. Listen to [B]VernonDozier[/B] and [B]niek_e[/B]. They know what they are talking about. Your program is a C program (not C++), so you shouldn't be using C++ stuff in it. | |
Re: Your math is off. [url]http://en.wikipedia.org/wiki/Determinant#Determinants_of_3-by-3_matrices[/url] (Watch what you do with those minus signs.) Good luck! | |
Re: I actually wrote a little program to do just that not too long ago: [b]strip-cr.cpp[/b] [code=C++] #include <algorithm> #include <functional> #include <iostream> #include <iterator> using namespace std; #if defined(__WIN32__) || defined(_WIN32_) || defined(__WIN32) || defined(_WIN32) || defined(WIN32) #include <cstdio> #include <fcntl.h> void std_binary_io() { _setmode( _fileno( stdin ), _O_BINARY ); … | |
Re: Almost exactly what I was going to say. Your professor is giving you a hard time for using getch()? I would be hard-pressed to find a modern 32-bit Windows compiler that [i]doesn't[/i] support it. And only a little less hard-pressed to find an old 16-bit DOS compiler that doesn't. It … | |
Re: Hmm, I just replied to your last post... Huffman only works if the tree is properly formed. If you are getting a larger output file then your tree is malformed. You are accounting for the difference in what it takes to actually [i]store[/i] the tree in the output, right? If … | |
Re: Use [URL="http://msdn.microsoft.com/en-us/library/ms682489(VS.85).aspx"][B]CreateToolhelp32Snapshot[/B]()[/URL] with the TH32CS_SNAPPROCESS flag and [B]Process32First[/B]() and [B]Process32Next[/B]() to get a list of processes on the system. For each process, create another snapshot using the TH32CS_SNAPMODULE flag and the process ID. For each module ID use [URL="http://msdn.microsoft.com/en-us/library/ms683197(VS.85).aspx"][B]GetModuleFileName[/B]()[/URL], and look for the modules whose names end in ".exe". The … | |
Re: What exactly do you mean by "columns"? The same as in your code? If so, perhaps it would help to stare at the cute animation over at [B][URL="http://en.wikipedia.org/wiki/Pascal%27s_triangle"]Wikipedia: Pascal's Triangle[/URL][/B]. You'll notice that you don't have to complete a whole row to skirt down just one "column". Good luck! | |
Re: If you plan to do any serious programming in C++ you absolutely must have a good [URL="http://www.cplusplus.com/reference/clibrary/cstdio/remove.html"]reference[/URL]. How did you learn about the function to begin with if it wasn't with an example or reference? | |
Re: maybe: :twisted: (Google "haskell maybe" if you are confused.) /me runs away | |
Re: ...which is the correct solution for Linux. On Windows, register a new window message (specific to your application) and broadcast it when your program is considering starting up. Any existing instance should respond that it already exists. The new instance can then terminate. If there isn't any response, then there … | |
| |
Re: Huffman codes are all variable-length --don't tack-on extra zeros (that would change the code). Your tree should be organized top-down with branch 0 having a summed-weight <= branch 1. (Note: the tree will have a "random" balance.) The huffman code is just a list of branches taken in the path … | |
Re: Complain to your vendor. If their DLL is broken they are obligated to fix it. Otherwise, read on: For some oddball reason the C++ design doesn't think that system exceptions belong as part of the exception-handling structure. (Nevermind that [i]every[/i] computer hardware has access interrupts, div-by-zero interrupts, etc.) You need … | |
Re: Reminds me of the grandaddy of all screensavers. Something like [code=C] #include <stdlib.h> #include <stdio.h> #include <time.h> int main() { srand( time( NULL ) ); while (1) printf( "%*c", rand() % 15, '*' ); return 0; } [/code] (This, of course, is just the simplest possible version...) | |
Re: That depends entirely on the OS and the compiler vendor. I'm pretty sure that old Turbo Pascals will properly crash if you try to overflow the heap. Delphi will raise an exception. For other vendors, particularly on OSes other than Windows, your results may vary. Hope this helps. BTW, please … | |
Re: Google "mingw sdl" and take a look through the first few links. If you haven't already, make sure to upgrade to the latest version of [B]MinGW[/B] (Dev-C++ comes with a pretty old one). Good luck! | |
Re: With Windows, there is no such thing as 'identical systems', alas. Because of its age GW-BASIC has some difficulties handling the hardware/software changes that have occurred beneath it. XP's DOS emulator is actually rather weak, and is known to goof in weird spots. A good spot to start when dealing … | |
Re: Take it one step at a time with [B]car[/B] and [B]cdr[/B]: define xs (((GOOD))((NIGHT))) car xs --> ((GOOD)) cdr xs --> ((NIGHT)) car (car xs) --> (GOOD) cdr (car xs) --> () etc. | |
Re: As no one has responded yet... Batch files wait for each command to finish before continuing on to the next. I am, however, surprised that [inlinecode]start "C:\Program Files\Mozilla Firefox\firefox.exe" w[I][/I]w[I][/I]w.google.c[I][/I]om[/inlinecode] will cause IE to start. | |
Re: Argh, I couldn't find a simple example on the web. So, without further ado: [b]hello.dpr[/b] [code=Delphi] program hello; {$apptype console} uses greet; var index: cardinal; name: string; begin if ParamCount > 0 then for index := 1 to ParamCount do Salute( ParamStr( index ) ) else begin Write( 'What is … | |
Re: In terms of how we humans view it, bits are treated the same way as we do any other number: most significant to least significant: [inlinecode]1010 binary[/inlinecode] Which reads as, left to right, [tex]{1}\times{2^3} + {0}\times{2^2} + {1}\times{2^1} + {0}\times{2^0}[/tex] The shift operations assume this point of view. Hence, shift-left … | |
Re: Yes, it is an encoding issue. I suspect that it comes from the way your [i]editor[/i] is saving the text file. There are several ways to 'encode', or store, character data. There is the old [b]char[/b]-sized [b]ASCII[/b] encoding, but that is limited to only 7-bit ASCII characters and any [i]system … | |
Re: You will need to provide a [b]default constructor[/b]. Then you can use [b]konto[/b] in arrays and other containers. [code=C++] ... #include <vector> using namespace std; ... class konto { public: konto( char* name = 0, int nomer = 0, double saldo = 0.0, float renta = 0.0 ); ... }; … | |
Re: For C++, I usually just forget the c-string stuff: [code=C++] #include <ciso646> // operator synonyms #include <iostream> #include <limits> // numeric_limits #include <string> #include <vector> #include <windows.h> // to play with the console (system() is evil) using namespace std; void easteregg() { ... } int main( int argc, char** argv … | |
Re: That is typically something handled by the build process. If you want to have the #defines in every file, you can specify the flag, or not, in your Makefile(s). Here's an example makefile that builds a program "foo" from the following files: foo.cpp baz.h baz.cpp quux.h quux.cpp If compiling on … | |
Re: You sure can. It'll do the same thing it would if you had called it from anywhere else in the code. But... you [I]shouldn't[/I]. It's kind of like Steve Jobs calling up Bill Gates and telling him how to run his business. There isn't any reason peers should be sticking … | |
Re: Never mix C and C++ I/O unless you know what you are getting in to. (Yes, the C++ standard says you can mix on the same target stream, but that is still somewhat vague and you mileage may vary with different compilers. Just don't mix unless you are forced to.) … | |
Re: Its full path is given as the first command-line argument. So you will want to add code to check to see if an mp3 file was supplied and autoplay it. How exactly you do it is up to you, but I recommend you read the documentation for [b]TApplication.Initialize[/b]. The following … | |
Re: I would suspect all that debug code in the VC++ options, and it doesn't look like you have many optimizations enabled either... Go to your project options and disable debug info and enable all the optimizations you can, and see if that doesn't make a difference. (I still can't get … | |
Re: You aren't talking about sofic shifts, are you? If so, how are you representing your graphs? | |
Re: The code looks fine to me. Are you sure there isn't an extraneous [inlinecode]#0[/inlinecode] at the end of [b]U[/b]? |
The End.