how do you do this on the PSP
and how do you read the second line?(i just want to read the first word on the first line and the first word on the second line)Code:ifstream b_file ( "example.txt" );
//Reads one string from the file
b_file>> str;
Printable View
how do you do this on the PSP
and how do you read the second line?(i just want to read the first word on the first line and the first word on the second line)Code:ifstream b_file ( "example.txt" );
//Reads one string from the file
b_file>> str;
That's C++ like File I/O
search for C File I/O
particular fgets/fscanf
tnx i found it:)
another question , I still cant copy a file on the memory stick to another place on the memory stick
with other words: i cant read and write at the same time:(
so i was thinking , cant i set a whole file on the RAM and dump it?
what does this error mean?
pack-pbp EBOOT.PBP PARAM.SFO NULL \
NULL NULL NULL
NULL strip_program.elf NULL
rm -f strip_program.elf
That's not an error, you'll always see that when compiling. Just the makefile cleaning up after itself I believe, when you see the rm command.Zitat:
Zitat von dracule
FILE *fp1 = fopen("./file.txt", "rb"); //open a file for readingZitat:
Zitat von hallo007
FILE *fp2 = fopen("ms0:/file.txt", "wb");//open a file for writing
like that, then you can read and write at the same time.
or you could read it all to memory like you said and then write.
also I would suggest reading up on c file IO, if you already have do again. If you knew it well enough something as simple as copying a file should be no problem.Code:FILE *fp = fopen("./file.txt", "rb");// open a file
//get size of file
fseek(fp, 0, SEEK_END);
int size = ftell(fp);
rewind(fp);
//create the buffer to store the file
char *buffer = malloc(size);
fread(buffer, size, 1, fp);
then why does an eboot not appear? it creates an elf file, but no eboot.Zitat:
Zitat von RogueX
Try adding this line to your makefile:
Code:EXTRA_TARGETS = EBOOT.PBP
still not working, i got this off a tutorial, so it should work...
Post your makefile and main.Zitat:
Zitat von dracule
http://www.psp-programming.com/code/...heport-lesson5
thats the tutorial i followed, and i changed some stuff in the main (just made it 2d)
Spoiler for makefile:
Spoiler for main:
I was just going to start in C++, but this is the reason i never do, i always have problems compiling.
PS i named the dodads joan to see if it was changing anything (which it wasnt)
i might add also before i even changed anything, it wouldnt make a new eboot.
Zitat:
Zitat von dracule
With that makefile it didn't compile an eboot?Code:#------------------- Makefile for 'Lesson5' -------------------#
TARGET = LessonFive
OBJS = ./CTimer.o ./main.o ./TGALoader.o
INCDIR =
LIBDIR =
LDFLAGS =
LIBS = -lpspgum -lpspgu -lpsprtc -lstdc++ -lm
CFLAGS = -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Lesson5
PSPSDK = $(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
./CTimer.o: ./CTimer.cpp
$(CXX) $(CXXFLAGS) -c ./CTimer.cpp -o ./CTimer.o
./main.o: ./main.cpp
$(CXX) $(CXXFLAGS) -c ./main.cpp -o ./main.o
./TGALoader.o: ./TGALoader.cpp
$(CXX) $(CXXFLAGS) -c ./TGALoader.cpp -o ./TGALoader.o
Quite odd.
But why did you add all that stuff at the end?
like run: scekxploit and all that stuff?
Download the source/binary files from the tutorial and compile that.
If an eboot compiles then there's something wrong on your end.
If it doesn't, then the tutorial is wrong.
i didnt add any of that stuff at the end, i dontloaded the source and binary and ran make and it didnt work.
-= Double Post =-
the one you listed doesnt work either.
Im new to C so go easy on me :) Can you change the color and/or change the position of the text? thanks
I need to rotate my screen for an app iam creating cause everrything needs to be upsidedown the text the images.... EVERYTHING . how do i do that with C ?
In your VIEW matrix call sceGumRotateY(GU_PI);
well iam really really novice so: huh?
but the prob is I CANT COPY FROM ms0:/ TO ms0:/Zitat:
Zitat von Waterbottle
godam thats already the fift time i say that , i can copy to flash but not ms0:/ to ms0:/:(
is there perhaps just a command i can use to make an eboot, because this is really annoying not being able to make an eboot.
What error messages are you getting if any? Do you get a new elf file?Zitat:
Zitat von dracule
-= Double Post =-
You should be able to. If not, copy ms0:/ to memory then memory to ms0:/. Simple.Zitat:
Zitat von hallo007
-= Double Post =-
Wouldn't it be the Z axis?Zitat:
Zitat von Insert_Witty_Name
i get a new elf file, but no eboot. i already posted my makefile and main
If you look in the build.mak file, it shows you how it makes the eboot. You can easily write a batch file to do the same.
I do suggest you read up on all of the six tutorials that www.psp-programming.com has. (well the six basic ones, it has fileio tuts, PSPGU tuts, etc.)Zitat:
Zitat von BlackShark
Enjoy C. :)
I wouldn't. Those tutorials are for learning how to program for the PSP, not learning C or C++. Go here: http://www.cprogramming.com/tutorial.htmlZitat:
Zitat von PSPduh
i'm dling the psptoolchain and its been stuck at "Logging in as anonymous ... " for 20 mins
on try 7 now. can i change the dling site
Well I would assume he was talking about the PSP as this is the PSP development forum.Zitat:
Zitat von yaustar
Zitat:
Zitat von PSPduh
I stopped reading here, my bad.Zitat:
Im new to C so go easy on me
Alright, thanks guys!
Edit, also, very impressive Portfolio there Yaustar :tup:
I can't tell if that's sarcasm or not. :|Zitat:
Zitat von yaustar
It isn't.Zitat:
Zitat von PSPduh
-= Double Post =-
Thank you.Zitat:
Zitat von BlackShark
Zitat:
Zitat von BlackShark
:PCode:pspDebugScreenSetTextColor(0xFFFFFF);
I was wondering how to make a machine gun for a scrolling shooter. I have run into a problem because i can only display one bullet on the screen at once because when i try to shoot another, the variables are reset for the first one.
Main Loop:
Code:int main() {
char bullet_buffer[100];
Image* bullet;
int travel_x;
int travel_y;
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
SceCtrlData pad;
sprintf(bullet_buffer, "bullet.png");
bullet = loadImage(bullet_buffer);
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
clearScreen(0);
blitAlphaImageToScreen(0, 0, 5, 20, bullet, travel_x, travel_y);
if(pad.Buttons & PSP_CTRL_CROSS) {
travel_y = 260;
blitAlphaImageToScreen(0, 0, 5, 20, bullet, travel_x, travel_y);
}
travel_x = 240;
travel_y -= 5;
flipScreen();
}
sceKernelSleepThread();
return 0;
}
anyone? i left all night, but it didn't download 24 triesZitat:
Zitat von CoolRaccoon
i remember when i was seting up toolchain i had to go find mirors for half the files because they wern't there maybe you will to or you can try my toolchain.sh file http://rapidshare.com/files/12649221/toolchain.sh.html
thnx i'll tell you if it worked
-= Double Post =-
i didn't work.....:(
is there a way to use a bin2c file
as an .c file , so it dont need to compill always ( i have some files of 100 000 lines and that takes a moment;))Code:static unsigned int size_background = 74112;
static unsigned char background[] __attribute__((aligned(16))) = {
0x42, 0x4d, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
.............................
sorry idk thenZitat:
Zitat von CoolRaccoon
If you want more than one bullet at a time, you also need more then one variable (pair). So use an array of variables to store the bullets positions.Zitat:
Zitat von JaSo PsP
You'll also need a way to decide whether a variable in the array is already used, so you'll end up with three variables per bullet (x,y,active/used).
That already IS a .c file, so I don't know what you're asking.Zitat:
Zitat von hallo007
no it's an .h file , because if you do it with .c it will give an error in cygwin
(impledict declaration of....)
Huh???!??Zitat:
Zitat von hallo007
Im kinda not understanding what you are saying :P ..
Make sure u add
in main.c
#include "yourfile.c"
In the makefile
TARGET = Hi
OBJS = main.c yourfile.c
I dont understand what you were saying so i hope that helped :P