Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

dairiseky

@dairiseky
About
Posts
15
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • avenger_sb25//read, write data files
    D dairiseky

    Ok, I see. I just tested a bit this, and it's working ok. I will need some time to digest all this info (and faked info too ;P). If new quiery appear I will shout for help.:-D Thx, can I send to u some info about the robot, and some methods I intend to use to solve some problems? By the way are u good in maths? (probability and statistics?) If u want to answer to this, send the answer on my e-mail, plz. _____________________________ THX

    C / C++ / MFC question

  • getline()
    D dairiseky

    Who could explain to me how getline is working? I checked already a tutorial about it, but I didn't understand well. THX

    C / C++ / MFC tutorial question

  • avenger_sb25//read, write data files
    D dairiseky

    yep is ok about binary. Yet there is still a problem. The objectA must be a const char*, that is not. U said to me :

    class A
    {
    public:
    double x;
    double y;
    double speed;
    double z;
    };

    As u can see here if I want to write the x, y, z. I could do as:

    main(int argc, char *argv[])
    {
    A objectA;

    fstream File;
    File.open ("test.txt", ios::binary);
    
    File.seekp(0);
    
    objectA.x=25.314;//xcoord
    objectA.y=-478.215;//ycoord
    objectA.z=34821.01;//zcoord
    

    Up to here nothing wierd. But then when I want to write into file I will use:

    File.write(&objectA.x, sizeof(objectA.x));

    And the error will be: 'class ostream &__thiscall ostream::write(const char *,int)' : cannot convert parameter 1 from 'double *' to 'const char *' And even if I will write simply :

    File.write(&objectA, sizeof(objectA));

    There will still be the same error: 'class ostream &__thiscall ostream::write(const char *,int)' : cannot convert parameter 1 from 'class A *' to 'const char *' :confused: I might have get things wrong...:doh: THX

    C / C++ / MFC question

  • read a certain line from a text file
    D dairiseky

    Is it possible to get the size of datas to be written to file and then use this (their size), to be able to retrieve the right data? THX

    C / C++ / MFC ios performance help tutorial question

  • avenger_sb25//read, write data files
    D dairiseky

    ok got y. thx again. Though u didn't say to me what u meant by the lenght of a line. Does space and zero count in this lenght? i'm talking about the seekg(). Is this seekg() givin' me the possibility to read only a certain length of the file? THX

    C / C++ / MFC question

  • avenger_sb25//read, write data files
    D dairiseky

    Hi. Everything is nice about what u said to me for reading and writing to files. Except one or two things. :( Well first of all it cannot convert from objectA to char*. That's why I didn't use this method before, because I couldn't handle this stuff. Anyway why do u have to use binary files?

    outfile.write ((char*)objectA, sizeof(objectA)); //this line writes the complete
    objectA(field by field) into the file test.txt.
    Remember, the file contents are now binary.
    So u may see many strange character when you open test.txt in a notepad.

    THX

    C / C++ / MFC question

  • read a certain line from a text file
    D dairiseky

    Ok I like this idea. I will try to use it. Could i, in case i want more details contact u on ur private mail? THX

    C / C++ / MFC ios performance help tutorial question

  • read a certain line from a text file
    D dairiseky

    OK thx. Got the trick ! sorry for the deformation of skeeg :) I was in a rush to get the train.

    C / C++ / MFC ios performance help tutorial question

  • read a certain line from a text file
    D dairiseky

    First thx for friday. Then what do u mean by the same length? Is space or tab considered as getting in the value's lenth? Or just by adding zeros at the end? I looked in a tutorial for the skeeg stuff and didn't understand well how it works. Could u breif me about this, please? THX

    C / C++ / MFC ios performance help tutorial question

  • read a certain line from a text file
    D dairiseky

    i used here "<< " just to visualise things better, but if u have a better idea say it to me please :) THX

    C / C++ / MFC ios performance help tutorial question

  • read a certain line from a text file
    D dairiseky

    Thx a lot, I really thought i will get no answer to my silly queston. ;P Though is there a method that will allow me to read no matter what line of the text file, without being obliged to read all the file? I mean like positioning the "cursor" to a certain position and read from there? What I mean is if I have a bigger file as: -2363824.109 (x position) 4870666.240 (y position) 2.18 (speed) 4566888.0035 (z position) 58.6544 (something) 269.2 (something) And i if i want to retrieve for example the 3rd line. Is there a simple solution? THX

    C / C++ / MFC ios performance help tutorial question

  • read a certain line from a text file
    D dairiseky

    I have a file that contains the following datas: -2363824.109 (x position) 4870666.240 (y position) 2.18 (speed) I want to read from this file either just the x position, either the y position, either the speed. I did the following: int main(int argc, char *argv[]){ ifstream GPSFile; //mode lecture GPSFile.open("C:\\My Files\\GPSFile\\GPSFile.txt", ios::in);//ouvre le fichier //c'est le fichier où on écrit les datas du gps double CataCoordX, CataCoordY; double gpsx=0, gpsy=0; while (!GPSFile.eof()){//tant que le fichier reste ouvert if (GPSFile.rdstate() == ios::failbit){cout<<"ERROR, \n";} ///GPSFile.seekg(ios::beg); //go to the beginning of the file GPSFile >> gpsx;//on lit GPSFile >> gpsy;//on lit CataCoordX=gpsx;//la première val devient les coord sur x CataCoordY=gpsy;//la deuxième val devient les coord sur y }//endwhile cout << CataCoordX < This will print : 2.18 4.87067e+006 But me i want to print the first and the secon value. How to do this? THX

    C / C++ / MFC ios performance help tutorial question

  • Write a matrix to a txt file
    D dairiseky

    I thought ifstream is made for reading files only, and ofstream to be able to write into file. Did I miss something there? I want to write the values cellsV[i][j] into the BuiltMap file. THX

    C / C++ / MFC ios

  • Write a matrix to a txt file
    D dairiseky

    I want to insert the values i get from a matrix, in the order thay are in a text file. I mean by this the values to keep their place, on lines and columns. To read the values I did this: double LocalMap::SquareValue(int i, int j) { for (i=0; i0){ cellsV[i][j]=cellV[i][j]*cellV[i][j]; if (cellsV[i][j]>noise_border){ ofstream BuiltMap; //mode écriture BuiltMap.open ("C:\\My Files\\BuiltMap\\BuiltMap.txt", ios::in); //open file while (!BuiltMap.eof()){ //laisser i colonnes libres et j espaces libres BuiltMap<<"\n"<<" "<

    C / C++ / MFC ios

  • Conversion from int to string
    D dairiseky

    I am quite a beginner myself, but I think u can use pointers to do this. Something like: char *ptrs=NULL; char s[20]="a, c, d, f, l, m"; ptrs=&s[3];//pointer points le address of s[3] printf(" %d\n", s[3]);//should print the address *ptrs=63; //value of pointer is 63 printf(" %d\n", s[3]);//should print 63 I think this is not correct, but might give you ideas. :doh: THX

    C / C++ / MFC help question c++ tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups