ix255@sdcc6.UUCP (John Antypas @ UC San Diego) (06/28/85)
Does anyone know of the proper way to interface the Megamex (2.1) C compiler with Mac calls. The system will expect a Mac Pascal STR255. What do I feed it? *char doesn't work and MMC is very unhappy about the following (UNIX likes it though...) char buffer[255]; . . . buffer = " plot.res"; {Does not like above line! } buffer[0] = (char)(strlen(s) -1 ); Even if I did get it working, I then use it to call int myresource; myresource = openresfile(s); { Or whatever the name is } and get an a Resource Manager Error = -43. What's that? Any body out there with a clue PLEASE tell me! John Antypas UC San Diego uucp: ...!{ucbvax,decvax,ihnp4,dcdwest,noscvax}!sdcsvax!sdcc6!ix255 arpa: ix255%sdcc6@sdcsvax.ARPA
mike@smu (07/13/85)
Sorry guy, but you can't copy a string in C by a simple assignment statement! char buffer[255]; buffer = "Some string"; The above two lines are attempting to assign the *address* of the string constant to the array, and this is a meaningless operation. What you really want to do is char buffer[255]; strcpy(buffer, "Some string"); The strcpy() library routine will copy the source string (second arg) to the destination address given (first arg). Remember, when used in an expression, a string constant (or an unsubscripted array name) represents the address of the string, something of type char *. The Megamax interface routines do all the converting to Pascal style strings automatically. Mike McNally SMU mike@smu ...convex!smu!mike