I am receiving an mp3 file in packets over network and want to save them in mp3 format on my computer. I am programming in C++ and using Qt Creator as IDE.
To be more specific, I am storing the received data in a QDataStream object which is automatically writing to the file it is connected to...
Do I need any encoding or should I just name the file MyMusic.mp3 and that was it?
Thanks in advance
If the data you are receiving is an MP3, then it has already been encoded in that format. You just need to write it out to a file that has the extension .mp3
Related
iam in a deep trouble , I have an Arduino uno and a pn532 connected to it in SPI mode , I want to read a string from an nfc tag and output it to a text file , I have already managed to read from nfc tag and write on it easily , but what Iam facing now is how to output the string contained in the nfc tag to a text file instead of outputting it to the serial monitor of the Arduino studio , any help would be greatly appreciated , thanks a lot in advance .
If you want to write the file from the Arduino itself, you have a few options, depending on the available extra hardware and where you want to save the file.
The easier is to use a SD card and the standard SD Library. On the official reference page there are lots of examples.
If you want to save it on the PC, there are several virtual terminal applications that enables you to save the sent and received data. Coolterm is one of them, Putty is another one.
You can also make your own application that receives the data from the arduino through serial communication, and handle the file saving on this application.
I have been searching this, but couldn't get a good answer.
i have to send a file through COM port between two PC.
but i dont know how to detect the end of file.
In PC 1 i use teraTerm software to send file.
In PC 2 is use the following python code.
After the file is sent i need to put some message that the file is complete.
import serial
ser = serial.Serial('COM1')
ser.flush_input_buffer()
file = open('file.txt','a') #open empty file for appending
while True:
receivedByte = ser.read() # read 1 byte
file.write(receivedByte)
if (#detect end of file ):
break
print('file received')
Please note : PC is windows 8.1, Pyserial, Python 3.4
Please also suggest for Linux file
There is no EOF for a serial port as such. And what I can gather from the Internet teraTerm doesn't have a protocol for sending files, but just sends them in their raw form.
You could maybe set the read timeout for the serial port, so that the read would raise a SerialTimeoutException when there is no data left.
I tried this solution, although it is not as elegant and rather simple. It does work.
receivedByte = ser.read() # read 1 byte
while receivedByte != b'':
file.write(receivedByte)
receivedByte = ser.read()
print('file received')
I have a device which sends out a raw (Layer 2) Ethernet packet which I need to read and decode using a Qt based C++ Windows application. I believe I can do it using the winpcap libraries but would prefer a Qt way if possible.
Get a raw packet from pcap, wrap into QByteArray, munch on it using QDataStream. Qt doesn't include a replacement for pcap, so that's out of the question.
I'm writing a windows mobile app that connects to an Arduino board.
Currently in order to pass data i'm sending strings from and to the Arduino board.
Is there a way to pass objects or formatted data?
you could use json, which is very easily parsable on the mobile phone side.
it all depends on the kind of data you want to send.
As the arduino is a simple C++ device, you may go with a c structure or a binary object. If you are connecting from windows mobile OS <=6.5.3, you can write in c++ or c# (or vb). You can then use a serialized to convert from/to a structure/object. How many data do you need to transfer? And what types?
Hi I am using the CaptureNet application out of the box from this codeproject source:
http://www.codeproject.com/KB/directx/directshownet.aspx
What I'm trying to do is also capture audio from the mic in this whilst video from my webcam is being saved to an AVi file, I want to interleave audio into the same file. Currently the one described that comes with just video capture. I'm fairly new to this, I have managed to capture audio separatly as a WAV file but no idea where to start to save both video and audio into the same AVI file?
You need to connect audio stream to the second input pin of AVI Mux filter which is created after you connect video stream to the first input pin.