Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!matts From: matts@microsoft.UUCP (Matt SAETTLER) Newsgroups: comp.windows.ms Subject: Re: __ahincr Message-ID: <56004@microsoft.UUCP> Date: 21 Jul 90 02:05:11 GMT References: <6887@umd5.umd.edu> <118500044@uxa.cso.uiuc.edu> Reply-To: matts@microsoft.UUCP (Matt SAETTLER) Organization: Microsoft Corp., Redmond WA Lines: 37 In article <118500044@uxa.cso.uiuc.edu> mms00786@uxa.cso.uiuc.edu writes: > [...] >how do I access this memory? For example, suppose I wanted to create a memory >chunk filled with letter 'a', would the following work? > > hMem = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, 70000); > lpStr = GlobalLock (hMem); > for (i=0; i < 70000; i++) > *lpStr++ = 'a'; > > /* what a useful code segment! */ > > >Or would I have to worry about segment boundaries etc, possibly through >the use of this mysterious _ahincr? (assuming Microsoft C, of course) This will work, assuming you have defined lpStr as char huge * lpStr; The C compiler automatically generates the correct code to use _ahincr WHEN variables are defined as huge (as opposed to far). In other words, this will NOT work for moving through >64k: char far * lpStr; ...which is the same as... LPSTR lpStr; (and, as used here, i must be a DWORD or long or something big enough to handle numbers > 65535 ) --------------------- I speak only for myself, or so I'm told to say.