473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Define boolean in C

kirubagari
158 100+
Expand|Select|Wrap|Line Numbers
  1. bool x =false
  2.  
  3.     for (i=0;i< MAX_WAFERQTY_PER_LOT ;i++)
  4.     {
  5.        if (strlen(inHouseScribeArray[i])> 12)
  6.        {
  7.          x = true;
  8.  
  9.        }
  10.        else 
  11.        {
  12.          x  = false;
  13.          break;
  14.        }
  15.     }
  16.  
  17.  
  18.     if (x==false)
  19.  
  20.  
  21.     {
  22.         /* Transaction type */ 
  23.     if (strcmp(action, OPERATION_VERIFY) == 0) 
  24.     { 
  25.         strcpy(txnType, "v"); 
  26.     } 
  27.     else if (strcmp(action, OPERATION_INLINEVERIFY) == 0) 
  28.     { 
  29.         strcpy(txnType, "iv"); 
  30.     } 
  31.     else if (strcmp(action, OPERATION_RANDOMIZE) == 0) 
  32.     { 
  33.         strcpy(txnType, "ra"); 
  34.     } 
  35.     else if (strcmp(action, OPERATION_REORDER) == 0) 
  36.     {
  37.         strcpy(txnType, "r"); 
  38.     } 
  39.  
  40.     /* Filename format = <lotId>.<trackout time>.to */
  41.     strcpy(tmpBuff, toTime);
  42.     pTmp = strtok(tmpBuff, " ");
  43.     sprintf(fName, "%s.%s", Trim_End(lot), pTmp);
  44.     pTmp = strtok( NULL, " ");
  45.     strcat(fName, pTmp);    
  46.     strcat(fName, ".");
  47.     strcat(fName, txnType);
  48.  
  49.     /* Open file and write out header info */
  50.     sprintf(fullPath, "%s/%s", "AbnormalData" ,fName);
  51.     fPtr = fopen(fullPath, "w"); 
  52.     if( fPtr == NULL )
  53.     {
  54.         sprintf(tmpBuff, "Write_TO_DataFile: can't open %s", fullPath);
  55.         Log_Error(tmpBuff, parms->errorLog);    
  56.         exit(1); 
  57.     }
  58.  
  59.     /*
  60.     ** Replace the newline with a null
  61.     */
  62.     pTmp = strchr(startDate,'\n');
  63.     if( pTmp != NULL)
  64.         *pTmp=NULL;
  65.  
  66.     /*
  67.     ** Write out to file. 
  68.     */
  69.     /* Header */ 
  70.     fprintf(fPtr, "#Date range %.20s - %.20s\n", startDate, endDate);    
  71.     fprintf(fPtr, "%-10s %d\n", "Revision", 1); 
  72.     fprintf(fPtr, "%-10s %.10s\n", "Action", action);
  73.     fprintf(fPtr, "%-10s %.40s\n", "Lot", lot); 
  74.     fprintf(fPtr, "%-10s %.40s\n", "Operation", operation);
  75.     fprintf(fPtr, "%-10s %.20s\n", "Suboperation", subOperation);
  76.     fprintf(fPtr, "%-10s %.3s\n", "actualqty", actualQty);
  77.     fprintf(fPtr, "%-10s %.10s\n", "equipment", equipment);
  78.     fprintf(fPtr, "%-15s %.15s\n", "device", device);
  79.     fprintf(fPtr, "%-10s %.15s\n", "technology", tech);
  80.     fprintf(fPtr, "%-9s %20.20s\n", "Date", toTime);
  81.  
  82.     pTmp = strrchr(employee, ':');
  83.     if( pTmp != NULL )
  84.         fprintf(fPtr,"%-10s %.20s","Employee", ++pTmp);
  85.     else
  86.         fprintf(fPtr,"%-10s %.20s","Employee", employee);
  87.  
  88.     fprintf(fPtr,"\n%%wafer orig_slot orig_cass in_house_scribe vendor_scribe final_slot final_cass\n\n");
  89.  
  90.     /* Wafer content */     
  91.     i = 0; 
  92.     while((inHouseScribeArray[i][0] != NULL) && (i < MAX_WAFERQTY_PER_LOT)) 
  93.     { 
  94.         fprintf(fPtr,"wafer %3.3s %6.6s %20.20s %20.20s %3.3s %6.6s\n",
  95.                  origSlotArray[i], origCassArray[i], inHouseScribeArray[i],
  96.               vendorScribeArray[i], finalSlotArray[i], finalCassArray[i]); 
  97.  
  98.         i++;         
  99.     } 
  100.     fclose(fPtr);
  101.  
  102.     }
  103.  
  104.     else 
  105.     {
  106.     /* Transaction type */ 
  107.     if (strcmp(action, OPERATION_VERIFY) == 0) 
  108.     { 
  109.         strcpy(txnType, "v"); 
  110.     } 
  111.     else if (strcmp(action, OPERATION_INLINEVERIFY) == 0) 
  112.     { 
  113.         strcpy(txnType, "iv"); 
  114.     } 
  115.     else if (strcmp(action, OPERATION_RANDOMIZE) == 0) 
  116.     { 
  117.         strcpy(txnType, "ra"); 
  118.     } 
  119.     else if (strcmp(action, OPERATION_REORDER) == 0) 
  120.     {
  121.         strcpy(txnType, "r"); 
  122.     } 
  123.  
  124.     /* Filename format = <lotId>.<trackout time>.to */
  125.     strcpy(tmpBuff, toTime);
  126.     pTmp = strtok(tmpBuff, " ");
  127.     sprintf(fName, "%s.%s", Trim_End(lot), pTmp);
  128.     pTmp = strtok( NULL, " ");
  129.     strcat(fName, pTmp);    
  130.     strcat(fName, ".");
  131.     strcat(fName, txnType);
  132.  
  133.     /* Open file and write out header info */
  134.     sprintf(fullPath, "%s/%s", fPath ,fName);
  135.     fPtr = fopen(fullPath, "w"); 
  136.     if( fPtr == NULL )
  137.     {
  138.         sprintf(tmpBuff, "Write_TO_DataFile: can't open %s", fullPath);
  139.         Log_Error(tmpBuff, parms->errorLog);    
  140.         exit(1); 
  141.     }
  142.  
  143.     /*
  144.     ** Replace the newline with a null
  145.     */
  146.     pTmp = strchr(startDate,'\n');
  147.     if( pTmp != NULL)
  148.         *pTmp=NULL;
  149.  
  150.     /*
  151.     ** Write out to file. 
  152.     */
  153.     /* Header */ 
  154.     fprintf(fPtr, "#Date range %.20s - %.20s\n", startDate, endDate);    
  155.     fprintf(fPtr, "%-10s %d\n", "Revision", 1); 
  156.     fprintf(fPtr, "%-10s %.10s\n", "Action", action);
  157.     fprintf(fPtr, "%-10s %.40s\n", "Lot", lot); 
  158.     fprintf(fPtr, "%-10s %.40s\n", "Operation", operation);
  159.     fprintf(fPtr, "%-10s %.20s\n", "Suboperation", subOperation);
  160.     fprintf(fPtr, "%-10s %.3s\n", "actualqty", actualQty);
  161.     fprintf(fPtr, "%-10s %.10s\n", "equipment", equipment);
  162.     fprintf(fPtr, "%-15s %.15s\n", "device", device);
  163.     fprintf(fPtr, "%-10s %.15s\n", "technology", tech);
  164.     fprintf(fPtr, "%-9s %20.20s\n", "Date", toTime);
  165.  
  166.     pTmp = strrchr(employee, ':');
  167.     if( pTmp != NULL )
  168.         fprintf(fPtr,"%-10s %.20s","Employee", ++pTmp);
  169.     else
  170.         fprintf(fPtr,"%-10s %.20s","Employee", employee);
  171.  
  172.     fprintf(fPtr,"\n%%wafer orig_slot orig_cass in_house_scribe vendor_scribe final_slot final_cass\n\n");
  173.  
  174.     /* Wafer content */     
  175.     i = 0; 
  176.     while((inHouseScribeArray[i][0] != NULL) && (i < MAX_WAFERQTY_PER_LOT)) 
  177.     { 
  178.         fprintf(fPtr,"wafer %3.3s %6.6s %20.20s %20.20s %3.3s %6.6s\n",
  179.                  origSlotArray[i], origCassArray[i], inHouseScribeArray[i],
  180.               vendorScribeArray[i], finalSlotArray[i], finalCassArray[i]); 
  181.  
  182.         i++;         
  183.     } 
  184.     fclose(fPtr);
  185.     }
  186.     #ifdef DEBUG
  187.     printf("LEAVING Write_SA_DataFile\n"); 
  188.     #endif 
  189.  
  190. } /* end Write_SA_DataFile */
  191.  
  192.  
Attach is my code and im not sure wheather the boolean is correctly define..when i compile it,i got error message and syntax error

Syntax error at line 1825, column 7, file ExtractHDBDataForWaferSleuth_test.pc:
Error at line 1825, column 7 in file ExtractHDBDataForWaferSleuth_test.pc
Expand|Select|Wrap|Line Numbers
  1.      bool x=false;
  2. ......1
  3. PCC-S-02201, Encountered the symbol "x" when expecting one of the following:
  4.  
  5.    ; , = : ( [ * ? | & < > + - / % . ^ *= /= %= += -= <<= >>=
  6.    &&= ||= ^= | & == != <= >= << >> ++ -- ->
  7. The symbol ";" was substituted for "x" to continue.
  8.  
  9. Error at line 0, column 0 in file ExtractHDBDataForWaferSleuth_test.pc
  10. PCC-F-02102, Fatal error while doing C preprocessing
  11. *** Error code 1
  12. make: Fatal error: Command failed for target `ExtractHDBDataForWaferSleuth_test.
  13. c'
Kindly help
Apr 12 '11 #1
2 2690
Meetee
931 Expert Mod 512MB
What I see here in code, ';' is missing. See
Expand|Select|Wrap|Line Numbers
  1. bool x =false
In error code too, it seems so.
Apr 12 '11 #2
donbock
2,426 Expert 2GB
Are you using C or C++?
If C, what version (C89 or C99)?
In C99, you have to include <stdbool.h> before bool works as expected.
Apr 12 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: greg | last post by:
Discussion is invited on the following proto-PEP. ------------------------------------------------------------- PEP ??? - Overloadable Boolean Operators...
3
by: Nathan Sokalski | last post by:
I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" command in an Oracle database. I tried the following: Public Shared Sub SetDefineOff() Dim myconnection As New...
10
by: Ramprasad A Padmanabhan | last post by:
Hello all, On my linux box ( redhat 7.2 ), I have been using char as a boolean data type. In order to save on the number of bytes as compared to using int or short int. typedef char boolean;...
8
by: FrancisC | last post by:
how to define Boolean in C ? boolean abc; ??? is it default as True or False??
3
by: Trent Buck | last post by:
(Note: C99 supports variadic macros, but C89 does not.) I'm pretty sure what I'm trying to do is impossible, but I'll ask here in case I'm missing something. I'm trying to define generic,...
4
by: Peter Kirk | last post by:
Hi is it it correct that variables of types like Boolean and Int32 cannot be null? It appears these types are structs, and not classes and therefore variables cannot be assigned the value...
1
by: mark.milley | last post by:
Hi all - Okay, here's a question for all you MVPs out there--I'd like to define a default implementation for an interface. While I understand that when you implement a interface, empty routines...
76
by: KimmoA | last post by:
First of all: I love C and think that it's beautiful. However, there is at least one MAJOR flaw: the lack of a boolean type. OK. Some of you might refer to C99 and its _Bool (what's up with the...
71
by: David T. Ashley | last post by:
Where is the best place to define TRUE and FALSE? Are they in any of the standard include files, ever? Do any standards apply? What I've traditionally done is something like: #ifndef...
19
by: tshad | last post by:
I have a value in my sql table set to tinyint (can't set to bit). I am trying to move it into a boolean field in my program and have tried: isTrue = (int)dbReader and isTrue =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.