i have line:

#define REPORT_HEADINGS_1   "\n   Employee          Pay      Reg Hrs   Gross      Fed      SSI      Net\n"

but when I document my source code (print it to pdf for ex) it is too long and it wraps it up

when I try to insert a line break after REPORT_HEADINGS_1

#define REPORT_HEADINGS_1
"\n   Employee          Pay      Reg Hrs   Gross      Fed      SSI  Net\n"

it fixes the wrapping problem but the compiler won't read it anymore as it should. I know it's kind of a stupid question but I'm sure there is a easy fix to it.

Thanks in advance

Member Avatar for iamthwee

maybe...

/* main.c */
#include <stdio.h>

#define REPORT_HEADINGS_1 printf("\n   Employee    \
 Pay      Reg Hrs  \
 Gross      Fed      SSI Net\n");

int main ( void )
{
  REPORT_HEADINGS_1
  return 0;
}

nope, this method gives syntax errors in visual 05

Member Avatar for iamthwee

Try downloading gcc, it's much better than visual studio anyway.

#define REPORT_HEADINGS_1 printf("\n   Employee    " \
 "Pay      Reg Hrs  " \
 "Gross      Fed      SSI Net\n");

The \ at the end of each line folds long lines for the benefit of the pre-processor.

The compiler will then join "string " "literals" into "string literals" for you.

thanks a bunch, got that to work, pretty nifty feature:)

Member Avatar for iamthwee

Strange mine worked with gcc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.