Exforsys
+ Reply to Thread
Results 1 to 2 of 2

Struck with this Task

This is a discussion on Struck with this Task within the C and C++ forums, part of the Programming Talk category; I have working knowledge in C and now I have read some concepts of compiler design and I am trying ...

  1. #1
    Rahulbatra is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    124

    Struck with this Task

    I have working knowledge in C and now I have read some concepts of compiler design and I am trying to implement the basics of these in my C program. I am struck with the task of breaking the given string into token for further analyzing them in parser. Can anyone suggest me a method for accomplishing this task?


  2. #2
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128
    Suppose you want to break the string every 2 bits and make it as tokens you can use the below code to do the same.

    char a[20];
    int l;
    while((l = fread(a,2,f)) > 0)
    display(buf,l);

    By using the above code you can break the given string into token for further analyzing them in parser.


Latest Article

Network Security Risk Assessment and Measurement

Read More...