Is there a standard way in c (not c++) to down cast and get the maximum value if "loose significant digits"? e.g. /* ISO-c99: */ #include int16_t cast32To16( int32_t the32) { if( the32 => INT16_MAX ) return INT16_MAX; if( the32 <= INT16_MIN ) return INT16_MIN; return (int16_t) the32; } Friedrich
Ralf Friedrich Hain
Posts
-
Down cast from 32 Bit to 16 Bit. -
Pointers and the adresse busMy PC is a "32 bit system". That means 32 bit address bus => the highest address is 2^32 - 1 = 4294967296 That means also 32 bit data bus. (4 Byte per word) => the maximum of adressable memory is 4 * (2^32 - 1) = 17179869184 now programming in c/c++: sizeof( char ) = 1 (byte) difference of pointers of two successive char variables : 1 sizeof( int ) = 4 difference of pointers of two successive int variables : 4 sizeof( any Pointer ) = 4 => A char pointer must contain information about which of the 4 bytes in a 32 bit word is meant, and also information of the address on the address bus. => I cannot access the maximum of adressable memory with pointers, but only a fouth of it. (or less?) AM I RIGHT??? Friedrich
-
Help! "Access Denied"We have got a new server (W2K) on the company an new user names. Everytime I try to open an old vb-project, I get the message: "Access Denied" the projects log-File shows: "Line 86: Class MSComDlg.CommonDialog of the control CommonDialog1 was no loaded control-class" Or the like. (I am translating the messages from German) All works correct if I login as local Administrator. How can I "access" "C:\WINNT\SYSTEM32\MSCOMM32.OCX" with my user-login on the Server-Domain? By the way: I think its the same cause for following problems: - I cannot anymore give open access on the network of my local folders. - Ugly problems in login to Visual Source Save (only starting as local Admin, but then not allowed to access the database on the network ) Thanks in advance Ralf Hain Friedrich
-
Replacement for "line"-contol.I am looking for al line-control for VB. (maybe VB.NET - But I still haven't switched to) Ideally it would work like the "connections" between shapes in Excel. The line should present a connection between some self-made controls. The user should be able to edit the lines, so that he/she can make a little network (1 to 2 screens full). Up to now I've done some experiments with the existing line: Determing the distance between the click(x/y) and a line => self-made "click" event ... Thanks in advance. Friedrich
-
Problems with ADO and r/w access to csv filesI am trying to createn an app in VB6.0 and Win98 to edit a simple csv (comma separated values)-file. The csv is not very big, so memory is no problem. But I wanted to make life easy by using SQL-commands, so I decided to use ADOdc and MSHFlexGrid(e.g.) I figured out some solutions, but noone works. If somebody could help me to get just one to work I would be glad. (I thought using ADO woudl be RAD, but if I needed a long time to understand that db-Stuff. If I not succeed fastly, I will use a ListView and populate it "by hand" :( ) First Idea: (Without ADO) MSData-Control and MSDBGrid. I can display the Data in the Grid. ok. But when I try to edit the data I get: "[Microsoft][ODBC Text Driver] ISAM doesn't support updating Data in a connected Tabel" (or sth like this, I translate from German) 1) How to solve this? 2) What (the hell) ist ISAM? Second Idea: (With ADO) ADOdc: Provider: MS OLE DB Provider for ODBC Drivers, ADOdc: DataSource Name: Text-Files ... ADOdc: Test connection: ok! But also same message like above after editing: "[Microsoft][ODBC Text Driver] ISAM doesn't support updating data in a connected Tabel" (or sth like this, I translate from German) (MY FAVOURITE IDEA!!) 1) (Questions like above) Another idea: creating a db1.mdb (MS Access), creating a macro to import the my.csv, creating another macro to export it. Idea: Start Import, then access the mdb by ADOdc-control, finally export. 1) How to get rid of fixed path in MS Access file-import? 2) The .mdb-File can be used without MS Access installed on the machine. Am I right? 3) How can I start MS-Access-macros from my VB app?? And another idea: .udl | Provider "OLE DB for MS Directory Services" has worked with MSData Control, but just under W2K. In W98 the checkboxes for "Share Deny None" etc are greyed, and it doesn't work. 1) Whats MS Directory Services? (This "Active Directory??) 2) Does this work on WinNT? (its the SYS to run on) Are there some "Packets" to install "MS Directory Services" to get it to work? My last idea: Do some registy-manipulation (I havn't done yet and want to avoid this): http://support.microsoft.com/default.aspx?scid=kb;de;245524 Friedrich
-
Looking for csv-Editor.It should be a small program to edit tabular data. User friendly. Freeware. Open source if possible. German UI would be nice, but is not a must have. Any idea?:rolleyes: Ralf Friedrich Hain
-
Help! NetDDE on WinNT ok, on Win2K ko.My Application is using NetDDE and runs good on Windows NT. But it doesn't run under Windows 2000. I used DDEshare.exe to create all the shares and gave them a trusted status. DDESpy results: the first Task is a Callback. Differences: Type = Unregister (Win 2000) Type = Register (Win NT) How can I make the type go Register? :confused: Server on NT is programmed in Borland c++; I would be glad not to touch this sources. Client on W2K will be programmed in VB, but see the Problems. I know that NetDDE is out, but I don't want to change all the code. Any idea? Thanks in advance. Ralf Friedrich Hain
-
Browse Information File (.BSC)How to generate a .BSC file, in case a complete build is not possible? Background: I want to browse an old Borland-Project. Of course, it is not compilable because of the foreign libaries. Friedrich
-
Help!! ADO and NT... using InstallShield. It has made a setup.exe with all things which are needed. Thanks :-D Friedrich
-
Help!! ADO and NTSorry, I was not precise enough. I didn't use the #import, I used "Project | add | Controls | Registred Active-X controls"... (sth like that, I'm using a german visual studio) I dragged the control with the mouse to a dialog in the dialog-editor ( and a MS-Data Grid etc ) "Nothing" means, nothing happens if i double click on the Icon in Win Explorer. Just as it wasn't there. To Debug, i would have to install Visual sudio to the NT system. But I wanted to avoid it, cause it is always a matter: running on the development-computer is successfull, running on an other system fails: On another NT System with Visual Studio, the application started, the starting querie succeded, but the user-queries failed (access error). ? Thanks for your answer. Friedrich
-
How to continue a chaos project?How to continue a chaos project? I've got to continue a project missing documentation and comments. The former author has left the company ( the best thing he has done for the company ). His Knowledge of OOP was quite low. It is not possible to persuade the boss to give up and make a totally new start on this project. So I have to renew the most problematic part. Its the communication via RS232 to an Epson Robot-controller. Besides, its a Borland 3.0 project. Can anybody give some hints how to continue a chaotic software? :| Friedrich
-
Help!! ADO and NTI've got my application ready and it is running perfect under my developing computer (win95), but on an other machine (winNT) it doesn't start at all!!! No error-message is shown! I think the proplem has to do with the control "Microsoft ADO Data Control, version 6.0 (OLEDB).lnk" It is a matter of different paths? "c:\windows\system\msadodc.ocx" on w95 and "c:\winnt\system32\msadodc.ocx" on NT ? I already use the MFC as a static lib. ADO 2.5 is installed on both computers. Please help me! :confused: :confused: :confused: Friedrich
-
What's it like at your work place?6 employees in an office, most time 2 of them telephoning at the same time. Most time there is at leas one person not working at the software department there and discussing sth. So its often loud. Telecommuting? Would be the greatest problem for the boss, because he can't enter the office and start to discuss sth. I think he just has not an own email-account. I'm writing software for machines, so it makes sense to be in the firm, cause mostly you can't test your programms "offline". btw offline: some computers there are just "offline", cause the network-officer has so much to do ... Nevertheless, the boss encouraging me, and he is the best I ever had, so I will stay at this company for a while. Friedrich
-
printing MS Data-Grid? or copying?I've got a MS Data-Grid Control V6.0 OLEDB in my application. Is there an easy way to print it? Or alternavtively: Is there a way to copy it and paste to Excel? :-| Thanks. Friedrich
-
Funny code againAs studends we were forced always to use a big header for every function, even if it had just one comand: /********************************************************************************/ /* */ /* Funktion : */ /* Klasse : */ /* */ /********************************************************************************/ /* */ /* Autor : */ /* */ /* Beschreibung : */ /* */ /* Vorbedingung : */ /* Nachbedingung : */ /* */ /* Parameter : */ /* */ /* Rückgabewert : */ /* */ /********************************************************************************/ /* */ /* V | Datum | KZ | Anmerkung */ /*------------------------------------------------------------------------------*/ /* | | | */ /* | | | */ /* */ /********************************************************************************/ My solution was: #include "headerToMyFunction.h" int MyClass::MyFunction( int xy ) { ... } :-) Friedrich
-
"UpdateAllViewsInAllDocuments"I want to set the font in a MDI-application. So I need a command like "UpdateAllViewsInAllDocuments", but that doesn't exist. Any suggestions? Thanks :-) Friedrich
-
How to lock a file?In CDocument::Serialize I access a .ini-file. All is ready now. But I want to protect the file currently in use from being edited/deteted/moved... with another application. How can I lock the file (like in Word: "The file you want to access is currently in use" (or similar) Can anybody help me? :-| Friedrich