Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

c++ script help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
#include <iostream.h>

int main ()
{
int selection;
cout << &quot;Insert 1 for pak 1 or 2 for pak 2. \n&quot;;
cin >> selection;
if (selection == 1)
cout << &quot;Created Pak 1 \n&quot;;
public static void rename( String C:\Dev-C++\tests\t1.dev, String C:\Dev-C++\tests\newdev.dev );
else if (selection == 2)
cout << &quot;Created Pak 2 \n&quot;;
else
cout << &quot;Invalid Command \n&quot;;
cin >> selection;
int exit;
cin >> exit;
return 0;
}
 
There you go.
Now your code is suppose to work perfectly.

#include <iostream.h>
#include <io.h>
int main ()
{
int selection;
int exit = 0;
cout << &quot;Insert 1 for pak 1 or 2 for pak 2. \n&quot;;
cout << &quot;Choose 0 for exiting.&quot;<<endl;
cin >> selection;
while( selection != 1 && selection != 2 )
{
if( selection == exit )
break;
cout << &quot;Invalid Command \n&quot;;
cin >> selection;
}
if (selection == 1)
{
cout << &quot;Created Pak 1 \n&quot;;
rename( &quot;String C:\\Dev-C++\\tests\\t1.dev&quot;, &quot;String C:\\Dev-C++\\tests\\newdev.dev&quot; );
}
else if (selection == 2)
cout << &quot;Created Pak 2 \n&quot;;

return 0;
}
 
Same thing, it works, but file doesnb't get renamed. I am using Console Application thing.
 
Ok i see,you need to replace

rename( &quot;String C:\\Dev-C++\\tests\\t1.dev&quot;, &quot;String C:\\Dev-C++\\tests\\newdev.dev&quot; );

by

rename( &quot;C:\\Dev-C++\\tests\\t1.dev&quot;, &quot;C:\\Dev-C++\\tests\\newdev.dev&quot; );

if your paths are correct it should work,i have tried it myself and the result was positive.
 
Okay, works. Thanks. Same concept with the &quot;include&quot; and remove &quot;String&quot; for other commands?
 
Can you be more specific.
give me some examples so i can understand what you are trying to say.
 
Well,

BOOL MoveFile( &quot;C:\\Dev-C++\\tests\\newdev.dev&quot;, &quot;C:\\Dev-C++\\tests\\testss\\newdev.dev&quot; );

doesn't work.

I have

#include <iostream.h>
#include <io.h>
#include <windows.h>
#include <Winbase.h>

included. Where does the microsoft site keep examples of these codes?
 
ok,you dont need to include &quot;winbase.h&quot; just &quot;windows.h&quot;.
Now,try this:
MoveFile( &quot;C:\\Dev-C++\\tests\\newdev.dev&quot;, &quot;C:\\Dev-C++\\tests\\testss\\newdev.dev&quot; );
it should work.
By the way,you cant move directorys with it.

try the MSDN library.
 
Are there any tutorials about making an actually windows application? Step by step about programming the status bar, menu, exiting, etc...?
 
Thank's again. Do you know where I can find technical, yet basic stuff like finding a line in a text file and editing it? WHat about registry editing.
 
The second part of the first tutorial link asks us to create a dialog box as a source file. Well, how do I create a dialog box with all of the options?
 
You got to use the resource editor that comes with VC++.
But first,tou have to create a resource script.
( File\New\Files\Resource Script ) &quot;on the menu&quot;.
you'll have to choose a name for your resource script,after that,you need to do ( Insert\Resource\Dialog\New).

good luck !
 
I know verry little about how to compile a windows applicarion with Bloodshed or &quot;Dev-C++&quot;.
I have use it before but not for Dialog Based application.
If you have already create a project and you want to add a &quot;DialogBox&quot; to it,you can go to the menu and choose (Project\Edit resource file).
From there you can choose the icon that correspond to &quot;Create new dialog window&quot;,once you have choose it,some informations about the dialog that you want to create will appear.You can leave the default options,except for the &quot;caption name&quot; you can choose your own,also you can choose another size for your &quot;DialogBox&quot;.
The default one is 200 x 200,you can choose one that suit your needs.For the rest,i dont have any clear idea on what you should do next.

I hope that this will help a little bit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top