C++ sınıfları ve FFmpeg kullanan bir projem var, fopen kullanmalı ve uygulama sanal alanına bir dosya yazmalıyım. C yazma ++ eşdeğerdir:iOS projesi için bir C++ sınıfında fopen kullanarak bir dosyaya yazmanız gerekiyor
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docs_dir = [paths objectAtIndex:0];
Bu bana ben çok fazla soru ben kullanabilmesi C++ bu kodu yazılacaktır? nasıl benim dosyalarım işleyebilirsiniz benim app kum havuzu, hiç olur Bir dosyada fopen mi var?
Bu
ihtiyacı yöntem uygulaması:int testGrabAndWrite(const char* streamURL, bool decode, const char* filename)
{
FILE *outfile;
int ret;
int counter = 0;
uint8_t *data; // Pointer to the received audio mem
int size; // Size of the received audio buffer
outfile = fopen(filename, "w");
if (outfile == NULL)
exit(1);
// Open the RTP stream
if ((ret = openStream(streamURL, decode)) < 0)
return ret;
// Print out info about the stream found
int tmpSampleRate, tmpBitRate, tmpChannels;
ret = getStreamInfo(tmpSampleRate, tmpBitRate, tmpChannels);
printf("\nSample rate:%d Bit rateL%d Channels:%d\n",tmpSampleRate,tmpBitRate, tmpChannels);
// Grab some sample data and write it to file.
while (counter < 500)
{
ret = getStreamData(data, size);
fwrite(data, 1, size, outfile); // Write RTP packets, i.e. mp3, to file.
printf("Wrote packet %d with size %d which returned %d. ", ++counter, size, ret);
}
fclose(outfile);
closeStream();
return ret;
}
'a dönüştürülmüştür. fopen()', C++ değil, "fstream" sınıfını ve arkadaşlarını kullanan bir C API'sidir. Entegre etmeniz gereken dersleri bize göster. – trojanfoe
bir .mm dosyası oluşturun .. C++ ve object-c –