Search DominoPower's 11,443 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
Coding Domino server tasks in C: the adventure continues (continued)

Back in Visual C++, put your cursor in the source code at the start of the LAPI_MAIN line and select Build->Start Debug->Run to Cursor, as shown in Figure B.

FIGURE B


To start the program running, you select Start Debug->Run to Cursor from the Build menu. Roll over picture for a larger image.

A DOS box should appear briefly, and a new section becomes visible in the VC++ IDE to show you (on the left) what the values of variables currently defined (select the "locals" tab) and (on the right) a blank display giving you a facility to watch the value of any variable you define. You just type in the name of the variable.

Since you're at the start of the program, the only two variables are argc and argv, as you can see in Figure C. If you're not a programmer, this sort of display can be baffling, but if you're a programmer, it'll warm your heart. Basically, this thing is a debugger, a device for walking through program code to see, line-by-line, exactly how the code operates. Sometimes the only way to find a bug is to watch every single line of code interact with every data object in the program.

FIGURE C


The debug run has started. Roll over picture for a larger image.

The yellow arrow on the left shows the line of source code reached so far, and in the context window shown below the arrow, the values of program variables appear. Argc is set to 4, as this is the number of arguments (argc is short for "argument count") the program received when it started. The four are aclhelp, test.nsf, Mickey, and Mouse. Since argv (i.e., argument vector or argument variables, depending on who's religion you believe) is an array, all you can see is the address in memory of the array. If you press the F10 key, you can watch the program execute a line at a time. F10 allows you to step through the code and "step over" any function calls. If the function call is a Lotus one that you don't have the source code to, you'll have to step over it. If the function call is yours, you can use the F11 key to "step into" the function and execute that a line at a time too.

When you get to the line that checks the number of parameters to see if there were enough, you should see the cursor skip over the bracketed code since there were enough parameters entered at the start to avoid the error message. Now press F10 to move past the lines that copy the strings (strcpy) from the argv array into our variables pathname and entryname. Once those lines have been executed, you should be able to check their content. In mine, the pathname is now "test.nsf" and entryname is "Mickey".

Now we have our first design problem. The user didn't put the entryname inside double quotes. If they had, entryname would contain Mickey Mouse, not just Mickey, as seen in Figure D.

FIGURE D


As the run continues more parameters appear. Roll over picture for a larger image.

Since a space separated "Mickey" from "Mouse," the C program thought it was a new parameter. So, since most user names contain spaces, I added a loop to the code to read these extra parameters and add them on to entryname with a space between them. Of course, the same applies to pathname since paths can have spaces too, but since it's not the last parameter, we can't do much about this except to tell users to put double quotes around pathnames that include spaces. As you F10 down to the first "for" loop, you'll see the program add "Mouse" to the end of the entryname using the "strcat" string concatenation function. This is pictured in Figure E.


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Lotus Technologies > Access Control (7 articles)
   Forcing immediate indexes to actually update immediately
   Enabling and disabling the single login setting in Notes 6
   Coding Domino server tasks in C: beyond Windows
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   Little known traps about Lotus Notes fields
Home > Microsoft Technologies > Visual C (2 articles)
   Coding Domino server tasks in C: beyond Windows
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Syncing Notes with Android phones
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Online safety for virtual learning
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Seek and find: Strategies to locate filed-away emails fast
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.

Register by April 10 to save $200.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login