PDA

View Full Version : Conversion from c to c++



martin8411
07-30-2011, 06:48 AM
Hey guys, I'm currently trying to convert a code from c to c++. I have corrected a few things, but I am now stuck. I tried compiling and I am getting errors. Btw I am using g++ compiler in terminal in linux.
the errors I am getting are:
audio_backup.cpp:**:24: warning: deprecated conversion from string constant to ‘char*’
audio_backup.cpp: In function ‘int generate_sine(const snd_pcm_channel_area_t*, snd_pcm_uframes_t, int, double*)’:
audio_backup.cpp:5*:76: error: invalid operands of types ‘unsigned int’ and ‘const char [2]’ to binary ‘operator<<’

I'm not sure what this means. Can any one help me please?

methew
08-21-2011, 09:27 PM
you can get the solution of every thing from the W*schools.I am learning many things related to programming and web development from this site.

mayareddy
08-25-2011, 07:10 AM
Hey everybody,
I was having trouble completing my last assignment which required me to redesign a C program into a C++ program using classes and objects.
So far my Cpp code looks like this:
insert
Code:
class Ciphertext{
public:
void output_ciphertext_screen(struct key_element key[26], FILE * fp);
};


fprintf(fp,"\n");
fprintf(fp,"Encoded : ");
for(i=0;i<26;i++)
fprintf(fp,"%c ",key[i].enc);
fprintf(fp,"\n");
fprintf(fp,"Decoded : ");
for(i=0;i<26;i++)
if(key[i].man_flag == 0)
fprintf(fp,"%c ",key[i].dec);
else
if(fp==stdout)
printf("%c ",toupper(key[i].dec));
else
fprintf(fp,"%c ",key[i].dec);
fprintf(fp,"\n\n");

}

int main()
{

output_ciphertext_screen print(key, stdout);
}
This code is supposed to take a ciphertext line by line from a file and output it onto the screen using C++. Basically, all I did was take the function I had earlier that is supposed to perform this operation and copied it into the object above. But, after compiling, I am getting errors saying:
error C2065: 'output_ciphertext_screen' : undeclared identifier.
I am new to C++ and am trying to get a better grasp of it so if you could point me in the right direction by showing me where my code is wrong or just giving me some tips, I should be able to figure out the rest of the program.




Overseas consultants in India (http://www.imtpconsultants.com/)

wandaA
08-29-2011, 03:16 PM
still cant figure out how to deal with malloc and calloc in c++ , any help?

kundanseo
09-03-2011, 03:16 AM
This is good work to convert from C to C++. C++ is often considered to be a superset of C. Most C code can easily be made to compile correctly in C++.

Aayus
07-10-2012, 09:42 AM
Converting a C or C++ nature for a project. Use the Convert to a C/C++ Project wizard to assign a C nature to a C++ project or vice versa.

Michelekaw
10-15-2019, 02:01 PM
Hi everybody, I need to extract the firmware from one SBC65EC ***rd. i have not the code but i need to program this firmware to other * SBC65EC ***rds. Its posible to extract this frimware from any way?

Thanks in advance,

Micheleroofe
10-19-2019, 10:53 AM
Has anyone experienced any issues with converting from *I to *0g?
I am having the following issue with OR and AND statements in SQL queries.

*i
F and Exception Exception
F or Exception F
Exception And F F
Exception or F Exception

*0g
F and Exception Exception
F or Exception Exception
Exception And F F
Exception or F F

Is there a patch out there that fixes? I have alot of queries written to match *i and a conversion to *0g will cause alot of issues.