473,402 Members | 2,046 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,402 software developers and data experts.

Help, BYTE ConsoleGetString(char *buffer, BYTE bufferLen)

2
Hello,

I don't know not much about C++, so here I have an example of code, and I don't now how to call it :( It should return an string from console to microcontroler.

BYTE ConsoleGetString(char *buffer, BYTE bufferLen)
{
BYTE v;
BYTE count;

count = 0;
do
{
if ( bufferLen-- == 0 )
break;

while( !ConsoleIsGetReady() );

v = RCREG;

if ( v == '\r' || v == '\n' )
break;

count++;
*buffer++ = v;
*buffer = '\0';
} while(1);
return count;
}
Mar 26 '08 #1
4 2113
gpraghuram
1,275 Expert 1GB
Hello,

I don't know not much about C++, so here I have an example of code, and I don't now how to call it :( It should return an string from console to microcontroler.

BYTE ConsoleGetString(char *buffer, BYTE bufferLen)
{
BYTE v;
BYTE count;

count = 0;
do
{
if ( bufferLen-- == 0 )
break;

while( !ConsoleIsGetReady() );

v = RCREG;

if ( v == '\r' || v == '\n' )
break;

count++;
*buffer++ = v;
*buffer = '\0';
} while(1);
return count;
}

If you call this function from another function then the first argument will have the string in it.
Before calling the function allocate memory for the variable and send it.

Raghuram
Mar 27 '08 #2
I think he is asking how to call macro ...
Mar 27 '08 #3
Calling the function depend up on the macro if the macro is integer you pass the decimal value to the function ....
Mar 27 '08 #4
cmare
2
Thank's guys!

I did now get an expert explanation of it from my colleague ;) .
Mar 27 '08 #5

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

Similar topics

5
by: Zulik | last post by:
Hello, I might have a bad day today but I have a byte buffer holding binary numbers. Now, I want to convert this to byte buffer with hex numbers. Is there any elegant way of doing that? Some...
4
by: ma740988 | last post by:
A few days ago I recieved yet again advice on implementing a buffer of bytes. At issue: (part 1) how do I take the contents of a struct, then dump (used sparingly) it into a byte buffer. ...
5
by: Sona | last post by:
I understand the problem I'm having but am not sure how to fix it. My code passes two char* to a function which reads in some strings from a file and copies the contents into the two char*s. Now...
0
by: Jack | last post by:
I am trying to develop a simple telnet client in MS.NET I have a small wrapper around the System.Net.Sockets.Socket class which takes care of sending and receiving data and handing it off to a...
2
by: caviar | last post by:
I'm trying to read in a ref parameter from a native dll, its working in vb if i use the kernel32 functions below transforming the ref param to a vb string: Now, i want to skip this vb dll and...
1
by: alfacom | last post by:
Hi, I have a char array. I would like to fill these values into a structure. Anyone can help me ? Posted Via Usenet.com Premium Usenet Newsgroup Services...
9
by: Gregory.A.Book | last post by:
I am interested in converting sets of 4 bytes to floats in C++. I have a library that reads image data and returns the data as an array of unsigned chars. The image data is stored as 4-byte floats....
5
by: shofu_au | last post by:
Dear readers, Before poorly reinventing the wheel I thought I would ask if a class already exists. I need to use a circular byte buffer that is thread safe. I cannot use MSMQ, my regular...
0
by: shofu_au | last post by:
Hi Group, I am trying without much luck to pack messages into a byte buffer using get and set accessors. I have attached a simplified example of what I am trying to do using byte variables....
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.