C :: Standard USB Protocol To Follow To Send Data To Embedded Board (and Vice Versa)

Mar 13, 2013

Is there any standard USB protocol which i can follow to send data to my embedded board(and vice versa). I have no clue on USB programming using c,is there any example code i could follow,

View 4 Replies


ADVERTISEMENT

Visual C++ :: Parent To Child Dialog Data Transfer And Vice Versa

Nov 28, 2012

I transferred data from parent to child. Problem occurred while send data from child to parent dialog.

Find the attachment....

void CChildDlg::OnBnClickedCancel() {
child1ctrl.GetWindowText(parObj.parentval);
::AfxMessageBox(parObj.parentval);
//parObj.parentctrl.SetWindowText(child1val);

[Code] ....

View 8 Replies View Related

C++ :: Text To Speech And Vice Versa

Nov 13, 2013

I was looking for a C++ library for use as stated in the title. I was considering using Voce; however, for the project, I wanted to be able to use a custom voice. For example, in most TTS programs you can pick voices. I wanted to record a custom one. However, I don't really know how these libraries work internally, and since the text to speech is referred to as synthesis, it seems they are created through algorithms rather than recordings. Is there any library which I could use a custom recorded voice with?

View 2 Replies View Related

C Sharp :: How To Get Value From One To Another Form And Vice Versa

Feb 23, 2013

I have two form in my project 1st form is FORM1 and 2nd form is FORM2.

FORM1 contain 3 textbox,1 button and FORM2 also contain 3 textbox, 1 button. I want to do....

when user fill FORM1 textboex and click button1 then all entries should be shown on FORM2. and vice versa. I used this code its working very good. when i pass value in form2 textboxes its show on form1 textbox. but i want to do, if textbox of form1 is already fill then form2 textboex should also shws form1 textbox value.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;  
namespace punchout {
    public partial class Form1 : Form

[code]......

View 3 Replies View Related

C++ :: Converting Enum To String And Vice Versa?

Feb 25, 2014

It is working:

#include <iostream>
#include <string>
#include <vector>
#include <map>
const int ENUM_NOT_FOUND = -1; const std::string NEW = " ";
enum Day {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};

[code]....

Ouput with GCC 4.8.1:

Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Name a day: Friday
day = Friday

But the problem is that whenever I define a new enum, I have to define the << and >> overloads for the new enum again. Isn't there a way to template that as well, so that the << and >> overload needs to be defined just once? My atttempt:

template<typename Enum>
std::ostream& operator << (std::ostream& os, Enum en) {
return os << EnumConversions<Enum>::toString (en);

[Code] .....

fails to compile. I guess the problem is Enum is not known at compile time, even though it should be deducible during run time? Error mentions ambiguous overload for operator>>.

View 6 Replies View Related

C/C++ :: Converting Fractions To Decimals And Vice Versa

Aug 1, 2014

I'm working on a Fraction Class assignment where I'm supposed to provide conversion operators to allow Fraction objects to be used in expressions containing float data values. The way I have it now, I'm getting an error that says operator float(const Fraction &) must contain 'void', which makes no sense to me. Lines 155 - 173.

// Fractions CLASS
// Source: Fraction2012.cpp
// Author: Warren H. Knox, Jr.
// Date: 11/8/2012
#include <iostream>
#include <cstdlib>
using namespace std;
class Fraction {

[Code] ....

View 9 Replies View Related

C++ :: How To Convert Char To String Or Vice Versa

May 26, 2013

how to convert char to string or vice versa,, Also make a program in which we convert a char into string ?

Conversion Char array to String

View 3 Replies View Related

C/C++ :: How To Convert Structure Name Into A String And Vice Versa

May 30, 2013

I need to convert a tsructure name into a string and vice versa. I don't really know how to do that in c.

View 11 Replies View Related

C++ :: How To Convert Text File Into Binary And Vice Versa

Dec 25, 2013

The problem is that I want to write a C++ program that converts an ordinary text file into binary and then reads that binary file and converts it to text file so that this text file equals to first text file. I have wrote this code for it.

int main() {
string name1 = "first", name2 = "sec", name3 = "third";
int j = 0, k = 0;
ifstream ifs(name1.c_str()); // Here I want to read from the ordinary text file (name1).

[Code] .....

Now what the ofs.write(as_bytes(j), sizeof(int)); or ifs.read(as_bytes(k), sizeof(int)); exactly mean?

In practice, the file name1 contains digit 5 and its size is 1 byte. The name2 contains some character/sign like [] and its size is 4 bytes and name3 contains digit 0 and its size is 1 byte, why? I before have created the name1 file in ordinary text file mode.

My machine is Windows 7 32-bit. My compiler is MVS 2012.

View 9 Replies View Related

C++ :: How To Convert Ordinary Text File Into Binary And Vice Versa

Dec 23, 2013

How to convert an ordinary text file into binary and how to convert that binary file back to a text file so that the first text file equals with the last text file?

View 8 Replies View Related

C :: Data Handling And Structure For Embedded UAV Project

Apr 16, 2014

Data handling for a UAV project I am trying. My background is in Microcontrollers but I have never had exposure to "sound" programming practice...

I have got 2 microcontrollers to drive a UAV craft I've made. One "firmware" micro collects all the sensor data and then passes it to the other "application" micro for control processing. Once decisions have been made this is sent back to the "firmware" micro so that actions are taken.

So in essence I am sharing a raw data chunk periodically between the 2 processors that has outputs and feedback data. For the moment this is captured as one big buffer array on either micro after receiving. For easier structure I thought of bouncing this buffer that contains all sensor information and control variables between the 2 processors (visualize a ping pong game with all the possible variables from both micros - bandwidth between the micros is not a limitation) There are quite a few modules that want to access information from this buffer and write control actions back to it.

I was thinking of constructing a struct on both micros to access this "raw data" from the buffer and set it up with variable names so that it is easier for functions to read info and write controls back.

But this would mean that the data is accessible to every function, and there is the fear that some functions will write to the input data or write to control variables that they should not have access to. I also need to reduce memory copies and the like due to limited memory on each micro.

View 4 Replies View Related

C# :: Send Data To Generic Handler That Accepts JSON Data

Apr 26, 2014

I have a situation where I am accessing an ASP.NET Generic Handler to load data using JQuery. But since data loaded from Javascript is not visible to the search engine crawlers, I decided to load data from C# and then cache it for JQuery. My handler contains a lot of logic that I don't want to apply again on code behind. Here is my Handler code:

public void ProcessRequest(HttpContext context) {
JavascriptSerializer jsonSerializer = new JavascriptSerializer();
string jsonString = string.Empty;
context.Request.InputStream.Position = 0;
using (var inputStream = new System.IO.StreamReader(context.Request.InputStream))

[Code] ....

I can call the function : getUserControlMarkup() from C# but I will have to apply some URL based conditions while calling it. The contentType.typeOfContent is actually based on URL parameters.

If possible to send JSON data to this handler then how to do that. I am trying to access the handler like this:

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Common.host + "Handlers/SideContentLoader.ashx?typeOfContent=1&UCArgs=cdata");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

But its giving NullReferenceException in Handler code at line:

ContentType contentType = jsonSerializer.Deserialize<ContentType>(jsonString);

View 1 Replies View Related

C++ :: Directory Name Must Immediately Follow -I Compile Error

Oct 17, 2013

I am trying to compile some code under opensuse 12.2. The code compiles fine under cygwin and CentOS. Under suse, I get the error "directory name must immediately follow -I"

This is the place in make where the error happens.

Code:
g77-3.3 -I ./src/src_common_depend/ -O2 -DVERNUM=6 -c -o bld_dir/FortranA.o src/src_client_main/FortranA.FOR
f771: error: directory name must immediately follow -I

The includes are specified in the make file with,
SOURCELOC = ./src
INCLUDES = -I ${SOURCELOC}/src_common_depend/

These are common includes that are used by more than one applications and so are stored in a common location.

I have tried leaving off the ./ and the trailing /

SOURCELOC = src
INCLUDES = -I ${SOURCELOC}/src_common_depend

And various similar combinations, including parenthesis instead of the curly braces.

I'm not sure why gcc under suse would be particular about this syntax when gcc under other distros seem to think it's fine.

This is the compile rule that g77 is implementing where the error occurs:

# compile src fortran objects with fortran preprocessor
$(BDIR)/%.o: $(SOURCELOC)/src_client_main/%.FOR
$(FCOMP) $(FCFLAGS) $(VFLAGS) -c -o $@ $<

View 11 Replies View Related

C :: Send Data Packet

Mar 6, 2015

how to send datapackets. When we send a data packet from device to another, say I have a "string". How Do I send it? Are data sent as a hex or binary number?If so do i first convert the "string" into hex or binary and then send it over the communication medium(say UART)??

I have two hex numbers to be sent using the UART, do i wrap it in some specific form and send it and retrieve it on the other side?Say if I have a data structure, in that case how do i send it? Sending data packets is very cruicial in an embedded system.

View 3 Replies View Related

C++ ::  Send Binary Data Over TCP/IP

Sep 3, 2014

I am writing a client-server program in C++ using C libraries. The server listens for a connection and when one is found, it is supposed to send a binary file(an image in my case) to the client. The server is sending the binary file perfectly after opening it and reading its contents into a buffer that is dynamically allocated in the SERVER file.

The problem begins when the client file is supposed to recv() the file, I do not know how I can allocate a buffer big enough for the file to be received. I know how to use malloc() and new, I prefer malloc() for executable size customization. Assuming the file being sent is 11000 bytes(note that this is an assumption and the client can not know the file size because the file size is dynamically generated by server).

How can the client generate a dynamically allocated buffer big enough to hold 11000 bytes?
OR
How can the client store the data in a buffer using recv() without knowing the file size.

Below is part of the code that does the send()'ing and recv()'ing.

SERVER

FILE *img = fopen("img.jpg", "rb");
fseek(img, 0, SEEK_END);
unsigned long filesize = ftell(img);
char *buffer = (char*)malloc(sizeof(char)*filesize);
rewind(img);
// store read data into buffer

[Code] ....

This outputs all the binary code perfectly but it is a bug because it can't be written to a file. Is there a way to dynamically increase the buffer until all filesize is received? Certainly, buffer needs to be dynamically allocated or program crashes ...

Also one more thing, when I telnet the server from command line, telnet displays all the output perfectly as well

Maybe telnet is storing data into a buffer behind the scenes, if so, how?

View 9 Replies View Related

C# :: Cannot Send Data From Client To Server

Oct 26, 2014

i am making a client server application but the problem is that i cannot send data from CLIENT to SERVER , but i can receive data from SERVER to CLIENT ... Below is mt client and Server code and i also have attached both client and server files...

CLIENT CODE:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace asynclient {

[code]....

View 3 Replies View Related

C/C++ :: How To Send Post Data Using Httpsendrequest

Sep 8, 2014

I'm trying to send a simple text string using httpsendrequest, everything works fine, the string is sent but I don't know how to retrieve it in the PHP server. Also when I use internetreadfile, the dwBytesRead is 0 meaning that there is no response from the server though the application works fine. This is the code that I have so far.

#define _WIN32_WINNT 0x600
#include <stdio.h>
#include <wininet.h>
#define BUFLEN 200
static const char *acceptTypes[] = {"application/x-www-form-urlencoded", NULL};
static const char *postData = "teststr=Hello+world&testval=42";
int main() {
HINTERNET hSession, hConnect, hFile;

[code].....

View 1 Replies View Related

C++ :: Streambuf For Socket - Send / Receive Data

Mar 27, 2014

I am trying to make a streambuf for a socket, which will use either WinSock or POSIX sockets depending on OS. I understand about how to send and receive data via sockets, but I don't really understand how to put that into a 'streambuf'. What functions do I need to override?

View 7 Replies View Related

C# :: How To Send And Receive Data From Serial Port

Aug 13, 2014

private void button1_Click(object sender, EventArgs e) {
serialPort1.PortName = "COM1";
serialPort1.BaudRate = 9600;
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;

[Code]...

In my project i have a serialport control and a button, there is no error but i want to know how actually this works, i want to send and recieve the data from the serial port don't know how to do it..

View 9 Replies View Related

C++ :: Send Binary Data (BMP File) To PHP Script

Oct 5, 2014

I found the following code in [URL] ....., that send .TXT files perfectly to php script in my server using Wininet, but when I insert a .BMP file, this file (.BMP) is correctly created and named in server side, but it is empty! I read that is necessary implement base64 encode for work properly, so how would?

PHP Code:

  #include <windows.h>
  #include <wininet.h>
  #include <iostream>
  #define ERROR_OPEN_FILE       10
  #define ERROR_MEMORY          11
  #define ERROR_SIZE            12

[Code] ....

View 12 Replies View Related

C :: Unable To Send Binary Data Via HTTP Response

Feb 7, 2013

I'm trying to send some binary data, such as an animated gif, via an HTTP response for a simple web server.

I am having issues having the browser close the connection after receipt of the data.

I create the header such as:

"HTTP/1.1 200 OK
Content-Length: <file size>
Content-Type: <file type>
<binary data>"

This is stored in a malloc'ed char *. To add the binary data I'm using fread: fread(request + strlen(request), 1, size, fp)

I then write 'total' bits via connfd:

write(connfd, request, total)
where total = strlen(headerRequest) + size + 3 (for ending
).

The writing seems to be okay however the image doesn't load and the browser still seems to be waiting for data.

If I added "Connection: close" to the header and closed connfd myself the page loads fine. Obviously, for efficiency purposes, I'd rather only close connfd once read() returns 0.

The header creation code is below:

======= Code:

/* Try to get file */
strcat(cwd, file);
if(endsWith (cwd, ".html") || endsWith(cwd, ".htm")) {
strcpy(fileType, "text/html");
binary = 0;
} else if (endsWith(cwd, ".txt")) {
strcpy(fileType, "text/plain");
binary = 0;

[Code]...

View 7 Replies View Related

C++ ::  Decrypting And Encrypting Following A Certain Protocol?

Mar 26, 2014

I have a certain method of encrypting text. You get the first character of the word. For example in the word "hacker", you get 'h', and then you get the last character 'r'. The encrypted word until now is "hr". Then we get the same word with the 'h' and 'r' removed, now it's "acke". I do the same thing and get the first character 'a' and the last one 'e' and them to the encrypted word: it is now "hrae".

The left letters of the word are "ck", again we do the same thing and take the first character 'c' and the last character 'k' and and add them to the new encrypted word so it is "hraeck". The above word has an even number of characters and at the end had 2 characters left 'c' and 'k',first and last, in some cases of words with an odd number of characters, only one character is left! I'm completely lost on how to encrypt and decrypt this.

View 4 Replies View Related

C++ :: How To Connect To Router Using WPS Protocol

Apr 29, 2013

I own a code written in c++ that is used to connect the router using the WPS protocol, but has to be modified to operate in "registrar" mode and I do not know much about c++.

View 1 Replies View Related

C++ :: UDP Protocol In A Conditional Statement?

Nov 4, 2013

I'm facing a serious problem with udp protocol. I have Master & Slave devices.I did implement the class as the follow pseudo code states

In Master side

while (true)
{
1-send data to slave;
2-get data from slave;
3-apply force;
}

In Slave side

while(true)
{
1-get data from master;
2-if (collision happnes)
send force to the master
}

the problem is in line 2 in Master side. Once I include the line I can't send or receive data. What do you think the problem is?

View 3 Replies View Related

C :: Address Family Not Supported By Protocol In Socket Programming In Linux

Oct 31, 2013

I am writing on C simple socket programs in Linux. I wrote client and server C programs. My client program is Code: #include<sys/socket.h>//for socket(), connect(), sendto() and recvform()

#include<sys/types.h>
#include<netinet/in.h>
#include<netdb.h>
#include<stdio.h>// for printf() and fprintf()

[Code]....

I am just testing whether can connect or not. I run server program first and client later. But when I run client, it showed that "Address family not supported by protocol".

View 3 Replies View Related

C/C++ :: Convert TXT File To Bin And Vise Versa

Feb 15, 2014

I am having a problem with converting a .txt file into a .bin file. It wokrs but only creating a new file and not being able to actually convert it, i have to do this using the fstream functions. I have already created the files in the project file e.g if i type file . file.txt is in the folder.

Here is my Binconvert function -

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
fstream fMyFile;
char Name[256];
char Words[256];
char txtextension[] = ".txt";
char binextension[] = ".bin";

[Code] ....

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved