Origin Ver.7.0558 and Service Release (Select Help-->About Origin): Operating System: Windows XP
I am reading in chars from a .txt file into a char array. Below is the code I am using. I and trying to write only a certain section of that char array into the script window or note window(using redirect) but I am having trouble finding the correct syntax to do so.
FILE *stream; char buffer[81];
//open current c file to read line from: stream = fopen( myFile, "r") if(stream==NULL) printf("The current C file cannot be opened.");
//read frist 80 chars and place them in "buffer": char ch; ch = fgetc(stream); for(i=0; (i<80)&&(feof(stream)==0); i++){ buffer[i]=(char)ch; ch=fgetc(stream); }
//add null to end string buffer[i] = '\0'; printf(%s/n", buffer); fclose(stream)
However, rather than printing the whole buffer array, I want to print only a certain portion of it. I need to be able to search it for the characters 'c''o''m''m''e''n''t' in a row that denote the comment section of the information that I am reading from the .txt file, and then print the portion after that until a " character is reached. How can I print just that section?