Click here to Skip to main content
15,924,039 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionQuestion about DVD seeking. Pin
Member 231624829-Sep-05 21:24
Member 231624829-Sep-05 21:24 
QuestionHow to run musi files in c++ Pin
Member 219796629-Sep-05 19:07
Member 219796629-Sep-05 19:07 
AnswerRe: How to run musi files in c++ Pin
Prakash Nadar3-Oct-05 15:25
Prakash Nadar3-Oct-05 15:25 
GeneralRe: How to run musi files in c++ Pin
Inder gujral12-Oct-05 21:47
Inder gujral12-Oct-05 21:47 
QuestionHow to kill a proceess running in Task Manager Pin
harijulie29-Sep-05 15:19
harijulie29-Sep-05 15:19 
AnswerRe: How to kill a proceess running in Task Manager Pin
Saksida Bojan30-Sep-05 9:09
Saksida Bojan30-Sep-05 9:09 
AnswerRe: How to kill a proceess running in Task Manager Pin
Prakash Nadar3-Oct-05 15:27
Prakash Nadar3-Oct-05 15:27 
QuestionIssues with ReadFile function Pin
Aditi48429-Sep-05 3:54
Aditi48429-Sep-05 3:54 
Hello..

I'm trying to read in data coming from the serial port.. the data can come in at any time (so the program has to monitor the serial port continuously, thats why i'm using a while loop in my code below). I'm reading Tag IDs (strings) which are formatted into packets.. each packet starts with the '&' character and ends with the '$' character..

Right now I read in the whats coming from the serial port (using a infinite while loop) into a string and then tokenize that string according to my packet delimiters.. the problem is that Readfile is returning after getting part of the tag ID packet and then the remaining part of the tag ID packet comes the next time the while loop is called.. I think its something to do with the way I use the readfile function in the while loop..my code is given below.. Please advice..

Thank you for your help..

<br />
<br />
char buffer[200000];<br />
<br />
 while (true)<br />
	{<br />
		printf("In while\n"); <br />
			<br />
		memset(buffer, 0, sizeof(buffer));<br />
		if (ReadFile(h, buffer, sizeof(buffer)-1, &bytesRead, 0))<br />
		{<br />
			printf("Read file has a result\n"); <br />
			if (bytesRead != 0)<br />
			{<br />
				printf("Got some bytes\n"); <br />
				printf ("%s", buffer);<br />
<br />
	//testing if buffer is broken down properly <br />
				printf( "Tokens in buffer:\n" );<br />
	/* Establish string and get the first token: */<br />
				token = strtok(buffer, "&$" );<br />
   <br />
				while( token != NULL )<br />
				{<br />
					/* While there are tokens in "string" */<br />
					printf( " %s\n", token );<br />
					/* Get next token: */<br />
					token = strtok( NULL, "&$" );<br />
				}<br />
<br />
			}<br />
			<br />
			else <br />
			{<br />
				printf("No bytes read\n"); <br />
			}<br />
		}<br />
<br />
		else {<br />
			printf("Readfile didnt give proper result \n"); 	<br />
		}<br />
		Sleep(200);<br />
	}<br />
<br />

Questiondaemon program on Windows Pin
misha_grewal29-Sep-05 0:08
misha_grewal29-Sep-05 0:08 
AnswerRe: daemon program on Windows Pin
prasad_som29-Sep-05 2:31
prasad_som29-Sep-05 2:31 
Questioniterators in unmanaged C++ Pin
allenmpcx28-Sep-05 15:09
allenmpcx28-Sep-05 15:09 
AnswerRe: iterators in unmanaged C++ Pin
Nemanja Trifunovic28-Sep-05 15:47
Nemanja Trifunovic28-Sep-05 15:47 
GeneralRe: iterators in unmanaged C++ Pin
allenmpcx28-Sep-05 16:50
allenmpcx28-Sep-05 16:50 
GeneralRe: iterators in unmanaged C++ Pin
toxcct28-Sep-05 21:31
toxcct28-Sep-05 21:31 
GeneralRe: iterators in unmanaged C++ Pin
allenmpcx29-Sep-05 5:54
allenmpcx29-Sep-05 5:54 
GeneralRe: iterators in unmanaged C++ Pin
toxcct29-Sep-05 20:57
toxcct29-Sep-05 20:57 
GeneralRe: iterators in unmanaged C++ Pin
allenmpcx1-Oct-05 14:17
allenmpcx1-Oct-05 14:17 
QuestionSearch engine inquiry Pin
heskel28-Sep-05 9:16
heskel28-Sep-05 9:16 
AnswerRe: Search engine inquiry Pin
Matt Godbolt2-Oct-05 4:24
Matt Godbolt2-Oct-05 4:24 
Questionlinked list and random numbers Pin
eprt28-Sep-05 6:40
eprt28-Sep-05 6:40 
AnswerRe: linked list and random numbers Pin
Christian Graus28-Sep-05 7:43
protectorChristian Graus28-Sep-05 7:43 
QuestionBeginner C++/CLI Handle Question... Pin
Cheese Weasel28-Sep-05 6:20
Cheese Weasel28-Sep-05 6:20 
AnswerRe: Beginner C++/CLI Handle Question... Pin
Christian Graus28-Sep-05 7:54
protectorChristian Graus28-Sep-05 7:54 
QuestionNeed an example, Please Pin
Funkytroll0127-Sep-05 6:56
Funkytroll0127-Sep-05 6:56 
AnswerRe: Need an example, Please Pin
mikanu27-Sep-05 11:00
mikanu27-Sep-05 11:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.