you could just call strcpy() to copy the contents of s2 into s1. Replace lines 21, 22 and 23 with this one line, unless of course your teacher said you can't use strcpy()
strcpy(s1+p, s2);
you could just call strcpy() to copy the contents of s2 into s1. Replace lines 21, 22 and 23 with this one line, unless of course your teacher said you can't use strcpy()
strcpy(s1+p, s2);
post some code, I don't know what you are talking about. If it's in my code snippet it's more than likely calling _findnexti64() until that function returns no more file names. If you don't know what a function does then you need to google for it and you will find out what it does.
Since you want to use FindFirstFile() you will have to call FindNextFile() instead of )findnexti64() that is shown in my code. Both functions do about the same thing. Also notice on each call of _findnexti64() the program checks to see if the file is a folder name, and if it is the function recursively calls itself to process all the files in that folder.
As C doesnt provide direct serialization
Serialization is nothing more than a fancy word for read/write to a file stream, whether the stream is the console screen, a file system, serial port, internet connection or something else. In your case "serialize" just simply means read/write to a file in the hard drive.
C langusge supports both binary and text files, you choose the file type in the second parameter to fopen(). "wb" means "write binary" while "w" or "wt" means "write text". The same with reading -- "rb" is "Read binary" and "rt" or "r" means "read text"
If you have a structure and you want to write it in binary mode then just do something like this:
#include <stdio.h>
struct foo
{
int x,y,z;
char something[255];
}
int main()
{
struct foo fooArray[8];
// open the file for binary writing
FILE* fp = fopen("filename.bin","wb");
if( fp != NULL)
{
// write out the entire array in binary
fwrite(fp, fooArray,sizeof(fooArray));
fclose(fp);
}
// now read it back
fp = fopen("filename.bin","rb");
if( fp != NULL)
{
// write out the entire array in binary
fread(fp, fooArray,sizeof(fooArray));
fclose(fp);
}
}
You apparently just have a void* so you will have to typecast it to char* in the fread() and fwrite() functions. The last parameter to those functions are the number of bytes to read/write, so I hope you have that info too.
You have to use a recursive function. I've written a code snippet that does exactly that for both MS-Windows and *nix. Or if you want to go a more portable way then use boost library.
Have you accomplished anything since you posted that question? If you have please post updated code so that we aren't looking at old obsolete code that bugs you have already fixed.
Is there a reason you want to use that library instead of just standard C FILE* functions? If all you want to do is write it to a file then just standard C library fwrite(), then fread() to read it back. You won't get more efficient then that. But if you want something more complex such as memory mapped files then maybe that library will do. Just scanning over the contents of the header file the library looks to be much more than what you need.
I'm glad to be rid of that preview -- it was very confusing
raining -- lots of thunder early this morning.
Yes, I think the output will be different on *nix then it is on MS-Windows. Have you tested it on both systems?
you realize vBulletin is not free??
jump is a macro which is defined to be the name of a register -- you can use register names as labels. Suggest you just delete lines 3 and 4.
lines 8 and 9 should appear after lines 10 and 11. The way they appear now lines 8 and 9 will always be executed regardless of the outcome of lines 10 and 11. Is that your intent? Probably not.
how to do that will depend on the compiler you are using. A Turbo C++ compiler code will not be the same as Visual Studio 2012 or Code::Blocks code. Here is a nice beginner's tutorial for Turbo C
instance of the class' member function is required to call the non-static member function
Maybe I misinterpreted that, non-static member functions can call both static and non-static member functions. Static member functions can only call other static member functions and use static class data.
why? Is there also a Cloud based compiler to go along with that Cloud based editor? Why not just use the editors that already exist on your PC?
[edit]I just read about it in the link you provided. It might be ok for web programming (HTML, java, etc) languages which do not need a compiler.
Is the database going to be on a LAN? If yes, then your job is quite easy -- there is not much difference connecting to a databse on a LAN then there is connecting to the database on the local computer. Just put the server's IP address in the connection string, all the reset is the same. If the server computer is running a firewall you might have to configure the firewall to allow incoming connection requests, but that isn't a programming problem.
what is 3Y/8??
I suspect VS is typcasting the int to char
We would like to run a vbulletin forum on that site as well.
I would suggest not -- vBulletin forums are heavily spammed and you will spend 3/4 your time removing spam. But if you really want to go that route I have a vBulletin license I'm not using any more and will sell you for half price. Send me PM if you are interested. vBulletin isn't all that difficult to set up, most of it is pre-planning what you want the forums to contain. The really difficult part is customization so that it doesn't look like a vBulletin site. That was one reason Dani decided to use her own forum software and get rid of vBulletin (there were other reasons too).
You are right. The code I posted should have been like below. It compiles as previously stated with Visual Studio 2012 but produces undefined behavior.
int main()
{
int i = 1024;
string n;
stringstream str;
str << i;
str >> n;
cout << n << '\n';
}
try this (I don't know if it will work or not):
time > time.out | wc > wc.out
You can get the char* from the string after it's returned.
char* s = string.c_str()
The only other option is to allocate new memory, then you have to make sure to delete it when no longer needed.
#include <cstdlib>
char* foo()
{
int i = 20;
char* n = new char[8];
sprintf(n,"%d",i);
return n;
}
int main()
{
char* n = foo();
delete[] n; // deallocate memory when done with it
}
Conrol Manager --> Administrative Tasks --> Computer Management -->Disk Management. There you will see your hard drive(s) and partitions. Dis you install Windows 8 in a separate partition? That would make it a lot easier to remove it.
What's the purpose of that function, why do you need to convert the int to a string? In c++ you can use stringstream to make the conversion
#include <string>
#include <sstream>
using namespace std;
std::string foo()
{
int i = 20;
string n;
stringstream str(i);
str >> n;
return n;
}
peanut butter sandwich
It started out yesterday such a nice day a friend of mine went out motorcycling. He got caught up in traffic on the freeway (similar to German autobahn's) and it started pouring down rain. Poor guy, I feel so sorry for him (not! :) )
What in the world are you talking about???
One way is to call ReadLine() then convert the String to int using Convert::ToInt(str)
Started out nice sunny day but now its pouring down rain. Something (probably lightening) turned my TV off and back on! First time I've seen that happen.
You can't talk about life without also talking about politics.
Living in the 1980s wasn't all that bad. afterall we had the Reagon revolution and Reagonomics. Of course he wasn't perfect, but he was IMHO one of the better US Presidents during my lifetime. The one thing I hated was the advent of hevy metal music, never did like it. And we can't forget the introduction of MS-DOS operating system in 1981 which completely revolutionized the world in the way we think and act.
Declare it like this and it will work because the compiler copies each of the fruits into it's own 10-byte buffer that can be overwritten.
char fruites[5][10] = {"apple", "banana", "orange", "apricot", "pineapple"};
Can it be possible to give the header file windows.h in turbo c
No -- turbo C compiler is too old. It is an ancient compiler that pre-dates MS-Windows and only uses ancient MS-DOS operating system. You need to get a more modern compiler such as free Visual Studio 2012 Express or Code::Blocks. For beginners I recommend Code::Blocks because it is simpler to learn how to use.
That's a bad link -- I get "File not found" error. Maybe the link it to a site which I don't have permissions to read. MySQL is a specific kind of SQL server so the contents of that pdf may or may not apply to other SQL server programs. If it teaches standard ODBC then you should be ok with it.
Here are some more MySQL-specific tutorials you might be interested in.
They are properties of the main form. For example look in properties for MinimizeBox and set it to either True or False. Change ControlBox property then see what happens to your program.
Unfortunately there are not a whole lot of tutorials in C language. The link I posted is probably one of the most comprehensive -- take a few days to study it well. Have you tried to google for "odbc c tutorials"? It's somewhat complicated stuff so you won't find anything short and simple. Requires a bit of studying and some practice. There are some c++ class wrappers, but if you are stuck with C language then they won't be of any use to you.
How long ago did you try to register? I think you can visit the site without registering, you just have to register to post. PFO is a mini version of DaniWeb but was originally created independently of DaniWeb, it only has forums for software development.
I just approved several accounts, yours is among them. You should be getting an email in a few minutes. Please let me know if you have more difficulties after you get the email from PFO.
I just checked at PFO and I don't see you in the moderation queue. It's highly possible I deleted your account thinking it was spam -- almost all new registrations at PFO are spammers. Register again and I'll make sure that doesn't happen again.
Depends on what you want to use it for. If all you want is a computer to browse the internet and get email then it doesn't really matter what computer you have. If you want to play high-end games then you need a computer with a lot of horsepower.
I had my son build mine about 13 months ago just before Diablo 3 was released. It has AMD 8-core 3600 MhZ processor, 16 gig RAM, 3 hard drives (total 5T) and running Windows 7 Ultimate. I use one of the external hard drives to store movies that I ripped so that I can watch them on my TV which is also connected to the internet.
A few months ago I bought my granddaughter a Microsoft Surface to use in college. It's nicer than a laptop mainly because the keyboard makes no noise, so she can use it during lectures. She seems to like it quite a bit.
use a modern compiler such as free Visual Studio 2012 or Code::Blocks with MinGW and you can easily do what you want. Turbo C++ is just too old to be able to do modern graphics objects. It's a nice compiler for universities to teach intro programming classes but not much use for anything else because no one uses MS-DOS any more.
You can read the file either the entire line at one time then step through the string and convert each character to hex, or you can read the file one character at a time in a loop, convert it to hex then write it back to the console screen. For now it might be easier if you read the file one characger at a time.
char c;
while( myfile >> c )
{
// print the character in hex format. You need not do any reformatting yourself, let cout do it for you
std::cout << std::hex << c << " ";
}
That makes no sense in a c++ program, so I guess I can just ignore it. c++ programs don't have web pages.
Have you used a debugge on that so that you can see the value of the variables on each loop iteration? My guess that behavior is happening is because k/2 is beyond the bounds of the array which causes array overflow and unpredictable results.
The loop should look something like this: You might want to put that message pump in a separate function so that it can be called from anywhere in your program without duplicating the code.
for(;;)
{
MSG msg;
while(GetMessage(&msg, hwnd, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// rest of loop goes here
}