home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18208 < prev    next >
Encoding:
Text File  |  1992-12-11  |  1.9 KB  |  46 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!europa.asd.contel.com!emory!swrinde!sdd.hp.com!think.com!enterpoop.mit.edu!ira.uka.de!math.fu-berlin.de!news.th-darmstadt.de!rbg.informatik.th-darmstadt.de!misar
  3. From: misar@rbg.informatik.th-darmstadt.de (walter misar)
  4. Subject: Re: how to I continue a long string on the next line of code?
  5. Sender: news@news.th-darmstadt.de (The News System)
  6. Message-ID: <1992Dec11.185441@rbg.informatik.th-darmstadt.de>
  7. Date: Fri, 11 Dec 1992 17:54:41 GMT
  8. References:  <EJH.92Dec10105245@khonshu.colorado.edu>
  9. Nntp-Posting-Host: rbhp58.rbg.informatik.th-darmstadt.de
  10. Organization: TU Darmstadt
  11. Lines: 33
  12.  
  13. In article <EJH.92Dec10105245@khonshu.colorado.edu>, ejh@khonshu.colorado.edu (Edward J. Hartnett) writes:
  14. > I'm writing a function with a bunch of lines like this:
  15. >   fprintf(fp,"Lat: %d Long: %d sza: %d elev: %d skin temp: %d model pressure: %d",
  16. >       s.lat,s.lon,s.sza,s.elev,s.modpres);
  17. >   fprintf(fp,"icc: %d retrieval method: %d sdll: %d sdml: %d n: %d box: %d flag: %d",
  18. >       s.icc,s.retmeth,s.;
  19. > This is fine on my big old Sun screen, but when I'm working on a text
  20. > terminal, or from home, these lines will wrap in an annoying way. I
  21. > want to continue them on the next line, breaking it in the middle of
  22. > the string. Like this:
  23. >   fprintf(fp,"icc: %d retrieval method: %d sdll: %d sdml: %d n: 
  24. >     %d box: %d flag: %d",s.icc,s.retmeth,s.;
  25. > But emacs C-mode couldn't handle the indentation properly, so I
  26. > presume that it wouldn't work. What is a good way to do this?
  27. One way is to put an \ at the end of the first line and begin the second at
  28. tab 0 like in:
  29. printf("Not a so long \
  30. string\n");
  31.  
  32. If you work with an ANSI compiler you could just make two strings, which will
  33. be concatenated by the compiler like in:
  34. printf("This looks a little"
  35.        " bit more readable\n");
  36.  
  37.  
  38. -- 
  39. Walter Misar
  40. misar@rbhp56.rbg.informatik.th-darmstadt.de
  41.