Log in

View Full Version : [help] gan bantu ane dong C programing


Badguy13
20th November 2011, 12:51 AM
ane khan lagi buat tugas.

suru bikin mesin cuci pke C programing.

ane udah selese bikinnya tapi dapet error pas mau save file.

pas dia print kata "ok" langsung eror.



disini gan kayanya erornya


Code:

void Save_File( char stra[] )
{
char ch;
char str[10000];
int count = 0;
int count2 = 0 ;
int count3 = 0 ;


if ((ptr = fopen("Log.txt" , "r")) == NULL)
{
printf("ok");
count = 0;
//ptr = fopen("BobyLog.txt" , "w");
while ( stra[count] != '' )
{
putc( stra[count] , ptr); //putc() character to store character from string into sPtr stream
count++;
}
}
else
{

count3 = 0;
while( (ch = getc(ptr) ) != EOF) //The getc() function returns the next character from stream sPtr
{
str[count3] = ch;
count3++;
}

while ( stra[count2] != '' )
{
str[count3 ++] = stra[count2];
count2++;
}
str[count3 ] = '';

ptr = fopen ( "Log.txt" , "w");
while ( str[count] != '' )
{
putc ( str[count] , ptr );
count++;
}
}

klo agan mau liat full nya disini (http://www.4*shared.com/document/Pj78zklI/mesincuci.html)

mohon pencerahhannya agan2 sekalian

ane minta tolong gan ane udah muter2 tambah eror malah.http://static.kaskus.us/images/smilies/sumbangan/8.gif


Spoiler for jangan dibuka:




ane cuma minta bantuan. mohon jangan :cabendan:, klo agan2 berbaik hati boleh minta :melonndan:







</div>